launchers

package
v0.0.0-...-a2eda15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Launchers

Launchers are responsible for translating sources (sources.LogSource) to tailers, and managing their tailers' lifecycle.

The logs agent maintains a set of current launchers, starting and stopping them at startup and stopping them when the logs-agent stops.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Launcher

type Launcher interface {
	// Start the launcher.
	Start(sourceProvider SourceProvider, pipelineProvider pipeline.Provider, registry auditor.Registry, tracker *tailers.TailerTracker)

	// Stop the launcher, and wait until shutdown is complete.  It is not
	// necessary to unsubscribe from the sourceProvider, but any background
	// goroutines or other resources should be freed.
	Stop()
}

Launcher implementations launch logs pipelines in response to sources, and manage those pipelines' lifetime.

Launchers are started when the logs-agent starts, or when they are added to the agent, and stopped when it stops.

type Launchers

type Launchers struct {
	// contains filtered or unexported fields
}

Launchers manages a collection of launchers.

func NewLaunchers

func NewLaunchers(
	sources *sources.LogSources,
	pipelineProvider pipeline.Provider,
	registry auditor.Registry,
	tracker *tailers.TailerTracker,
) *Launchers

NewLaunchers creates a new, empty Launchers instance

func (*Launchers) AddLauncher

func (ls *Launchers) AddLauncher(launcher Launcher)

AddLauncher adds a launcher to the collection. If called after Start(), then the launcher will be started immediately.

func (*Launchers) Start

func (ls *Launchers) Start()

Start starts all launchers in the collection.

func (*Launchers) Stop

func (ls *Launchers) Stop()

Stop all launchers and wait until they are complete.

type MockSourceProvider

type MockSourceProvider struct {
	// SourceChan is the unbuffered channel returned from all source-related methods.
	// Send LogSources to it to trigger behavior from launchers.
	SourceChan chan *sources.LogSource
}

MockSourceProvider is a fake SourceProvider that can be used to provide fake sources.

This is a useful tool in testing launchers.

func NewMockSourceProvider

func NewMockSourceProvider() *MockSourceProvider

NewMockSourceProvider creates a new MockSource Provider.

func (*MockSourceProvider) GetAddedForType

func (sp *MockSourceProvider) GetAddedForType(_ string) chan *sources.LogSource

GetAddedForType implements SourceProvider#GetAddedForType.

func (*MockSourceProvider) SubscribeAll

func (sp *MockSourceProvider) SubscribeAll() (chan *sources.LogSource, chan *sources.LogSource)

SubscribeAll implements SourceProvider#SubscribeAll.

func (*MockSourceProvider) SubscribeForType

func (sp *MockSourceProvider) SubscribeForType(_ string) (chan *sources.LogSource, chan *sources.LogSource)

SubscribeForType implements SourceProvider#SubscribeForType.

type SourceProvider

type SourceProvider interface {
	// SubscribeForType returns channels containing the new added and removed sources matching the provided type.
	//
	// Removed sources are pointer-equal to previously-added sources.
	//
	// Sources are not automatically removed when the agent shuts down.  Consumers should handle any
	// required shutdwon of running sources in their own Stop methods.
	SubscribeForType(sourceType string) (added chan *sources.LogSource, removed chan *sources.LogSource)

	// SubscribeAll returns channels containing all added and removed sources.
	SubscribeAll() (added chan *sources.LogSource, removed chan *sources.LogSource)

	// GetAddedForType returns channels containing the new added sources matching the provided type.
	GetAddedForType(sourceType string) chan *sources.LogSource
}

SourceProvider is the interface by which launchers subscribe to changes in sources.

The *sources.LogSources type satisfies this interface.

Directories

Path Synopsis
Package integration creates a launcher to track logs from integrations
Package integration creates a launcher to track logs from integrations
Package windowsevent is not supported on non-windows platforms
Package windowsevent is not supported on non-windows platforms

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL