file

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FilenameLabel = "filename"
)

Variables

View Source
var DefaultWatchConig = WatchConfig{
	MinPollFrequency: 250 * time.Millisecond,
	MaxPollFrequency: 250 * time.Millisecond,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	SyncPeriod time.Duration `mapstructure:"sync_period" yaml:"sync_period"`
	Stdin      bool          `mapstructure:"stdin" yaml:"stdin"`
}

Config describes behavior for Target

func (*Config) RegisterFlags

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

RegisterFlags register flags.

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlags with prefix registers flags where every name is prefixed by prefix. If prefix is a non-empty string, prefix should end with a period.

type FileTarget

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

FileTarget describes a particular set of logs. nolint:revive

func NewFileTarget

func NewFileTarget(
	metrics *Metrics,
	logger log.Logger,
	handler api.EntryHandler,
	positions positions.Positions,
	path string,
	pathExclude string,
	labels model.LabelSet,
	discoveredLabels model.LabelSet,
	targetConfig *Config,
	watchConfig WatchConfig,
	fileEventWatcher chan fsnotify.Event,
	targetEventHandler chan fileTargetEvent,
	encoding string,
	decompressCfg *scrapeconfig.DecompressionConfig,
) (*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() target.TargetType

Type implements a Target

type FileTargetManager

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

FileTargetManager manages a set of targets. nolint:revive

func NewFileTargetManager

func NewFileTargetManager(
	metrics *Metrics,
	logger log.Logger,
	positions positions.Positions,
	client api.EntryHandler,
	scrapeConfigs []scrapeconfig.Config,
	targetConfig *Config,
	watchConfig WatchConfig,
) (*FileTargetManager, error)

NewFileTargetManager creates a new TargetManager.

func (*FileTargetManager) ActiveTargets

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

ActiveTargets returns the active targets currently being scraped.

func (*FileTargetManager) AllTargets

func (tm *FileTargetManager) AllTargets() map[string][]target.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 Metrics

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

Metrics hold the set of file-based metrics.

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

NewMetrics creates a new set of file metrics. If reg is non-nil, the metrics will be registered.

type Reader

type Reader interface {
	Stop()
	IsRunning() bool
	Path() string
	MarkPositionAndSize() error
}

Reader contains the set of expected calls the file target manager relies on.

type WatchConfig

type WatchConfig struct {
	MinPollFrequency time.Duration `mapstructure:"min_poll_frequency" yaml:"min_poll_frequency"`
	MaxPollFrequency time.Duration `mapstructure:"max_poll_frequency" yaml:"max_poll_frequency"`
}

func (*WatchConfig) RegisterFlags

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

RegisterFlags register flags.

func (*WatchConfig) RegisterFlagsWithPrefix

func (cfg *WatchConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlags with prefix registers flags where every name is prefixed by prefix. If prefix is a non-empty string, prefix should end with a period.

Jump to

Keyboard shortcuts

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