targets

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileTargetType is a file target
	FileTargetType = TargetType("File")

	// JournalTargetType is a journalctl target
	JournalTargetType = TargetType("Journal")

	// DroppedTargetType is a target that's been dropped.
	DroppedTargetType = TargetType("dropped")
)
View Source
const (
	FilenameLabel = "filename"
)

Variables

This section is empty.

Functions

func IsDropped

func IsDropped(t Target) bool

IsDropped tells if a target has been dropped

Types

type Config

type Config struct {
	SyncPeriod time.Duration `yaml:"sync_period"`
}

Config describes behavior for Target

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(flags *flag.FlagSet)

RegisterFlags register flags.

type FileTarget

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

FileTarget describes a particular set of logs.

func NewFileTarget

func NewFileTarget(logger log.Logger, handler api.EntryHandler, positions *positions.Positions, path string, labels model.LabelSet, discoveredLabels model.LabelSet, targetConfig *Config) (*FileTarget, error)

NewFileTarget create a new FileTarget.

func (*FileTarget) Details

func (t *FileTarget) Details() interface{}

Details implements a Target

func (*FileTarget) DiscoveredLabels

func (t *FileTarget) DiscoveredLabels() model.LabelSet

DiscoveredLabels implements a Target

func (*FileTarget) Labels

func (t *FileTarget) Labels() model.LabelSet

Labels implements a Target

func (*FileTarget) Ready

func (t *FileTarget) Ready() bool

Ready if at least one file is being tailed

func (*FileTarget) Stop

func (t *FileTarget) Stop()

Stop the target.

func (*FileTarget) Type

func (t *FileTarget) Type() TargetType

Type implements a Target

type FileTargetManager

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

FileTargetManager manages a set of targets.

func NewFileTargetManager

func NewFileTargetManager(
	logger log.Logger,
	positions *positions.Positions,
	client api.EntryHandler,
	scrapeConfigs []scrape.Config,
	targetConfig *Config,
) (*FileTargetManager, error)

NewFileTargetManager creates a new TargetManager.

func (*FileTargetManager) ActiveTargets

func (tm *FileTargetManager) ActiveTargets() map[string][]Target

ActiveTargets returns the active targets currently being scraped.

func (*FileTargetManager) AllTargets

func (tm *FileTargetManager) AllTargets() map[string][]Target

AllTargets returns all targets, active and dropped.

func (*FileTargetManager) Ready

func (tm *FileTargetManager) Ready() bool

Ready if there's at least one file target

func (*FileTargetManager) Stop

func (tm *FileTargetManager) Stop()

Stop the TargetManager.

type JournalTarget added in v1.0.1

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

JournalTarget tails systemd journal entries.

func NewJournalTarget added in v1.0.1

func NewJournalTarget(
	logger log.Logger,
	handler api.EntryHandler,
	positions *positions.Positions,
	jobName string,
	relabelConfig []*relabel.Config,
	targetConfig *scrape.JournalTargetConfig,
) (*JournalTarget, error)

NewJournalTarget configures a new JournalTarget.

func (*JournalTarget) Details added in v1.0.1

func (t *JournalTarget) Details() interface{}

Details returns target-specific details.

func (*JournalTarget) DiscoveredLabels added in v1.0.1

func (t *JournalTarget) DiscoveredLabels() model.LabelSet

DiscoveredLabels returns the set of labels discovered by the JournalTarget, which is always nil. Implements Target.

func (*JournalTarget) Labels added in v1.0.1

func (t *JournalTarget) Labels() model.LabelSet

Labels returns the set of labels that statically apply to all log entries produced by the JournalTarget.

func (*JournalTarget) Ready added in v1.0.1

func (t *JournalTarget) Ready() bool

Ready indicates whether or not the journal is ready to be read from.

func (*JournalTarget) Stop added in v1.0.1

func (t *JournalTarget) Stop() error

Stop shuts down the JournalTarget.

func (*JournalTarget) Type added in v1.0.1

func (t *JournalTarget) Type() TargetType

Type returns JournalTargetType.

type JournalTargetManager added in v1.0.1

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

JournalTargetManager manages a series of JournalTargets.

func NewJournalTargetManager added in v1.0.1

func NewJournalTargetManager(
	logger log.Logger,
	positions *positions.Positions,
	client api.EntryHandler,
	scrapeConfigs []scrape.Config,
) (*JournalTargetManager, error)

NewJournalTargetManager creates a new JournalTargetManager.

func (*JournalTargetManager) ActiveTargets added in v1.0.1

func (tm *JournalTargetManager) ActiveTargets() map[string][]Target

ActiveTargets returns the list of JournalTargets where journal data is being read. ActiveTargets is an alias to AllTargets as JournalTargets cannot be deactivated, only stopped.

func (*JournalTargetManager) AllTargets added in v1.0.1

func (tm *JournalTargetManager) AllTargets() map[string][]Target

AllTargets returns the list of all targets where journal data is currently being read.

func (*JournalTargetManager) Ready added in v1.0.1

func (tm *JournalTargetManager) Ready() bool

Ready returns true if at least one JournalTarget is also ready.

func (*JournalTargetManager) Stop added in v1.0.1

func (tm *JournalTargetManager) Stop()

Stop stops the JournalTargetManager and all of its JournalTargets.

type Target

type Target interface {
	// Type of the target
	Type() TargetType
	// DiscoveredLabels returns labels discovered before any relabeling.
	DiscoveredLabels() model.LabelSet
	// Labels returns labels that are added to this target and its stream.
	Labels() model.LabelSet
	// Ready tells if the targets is ready
	Ready() bool
	// Details is additional information about this target specific to its type
	Details() interface{}
}

Target is a promtail scrape target

type TargetManagers

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

TargetManagers manages a list of target managers.

func NewTargetManagers

func NewTargetManagers(
	logger log.Logger,
	positions *positions.Positions,
	client api.EntryHandler,
	scrapeConfigs []scrape.Config,
	targetConfig *Config,
) (*TargetManagers, error)

NewTargetManagers makes a new TargetManagers

func (*TargetManagers) ActiveTargets

func (tm *TargetManagers) ActiveTargets() map[string][]Target

ActiveTargets returns active targets per jobs

func (*TargetManagers) AllTargets

func (tm *TargetManagers) AllTargets() map[string][]Target

AllTargets returns all targets per jobs

func (*TargetManagers) Ready

func (tm *TargetManagers) Ready() bool

Ready if there's at least one ready target manager.

func (*TargetManagers) Stop

func (tm *TargetManagers) Stop()

Stop the TargetManagers.

type TargetType

type TargetType string

TargetType is the type of target

Jump to

Keyboard shortcuts

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