agent

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 19 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAccumulator

func NewAccumulator(
	maker MetricMaker,
	metrics chan<- telegraf.Metric,
) telegraf.Accumulator

Types

type Agent

type Agent struct {
	Config *config.Config
}

Agent runs a set of plugins.

func NewAgent

func NewAgent(cfg *config.Config) *Agent

NewAgent returns an Agent for the given Config.

func (*Agent) Once added in v1.15.0

func (a *Agent) Once(ctx context.Context, wait time.Duration) error

Once runs the full agent for a single gather.

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

Run starts and runs the Agent until the context is done.

func (*Agent) Test

func (a *Agent) Test(ctx context.Context, wait time.Duration) error

Test runs the inputs, processors and aggregators for a single gather and writes the metrics to stdout.

type AlignedTicker added in v1.15.0

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

AlignedTicker delivers ticks at aligned times plus an optional jitter. Each tick is realigned to avoid drift and handle changes to the system clock.

The ticks may have an jitter duration applied to them as an random offset to the interval. However the overall pace of is that of the interval, so on average you will have one collection each interval.

The first tick is emitted at the next alignment.

Ticks are dropped for slow consumers.

The implementation currently does not recalculate until the next tick with no maximum sleep, when using large intervals alignment is not corrected until the next tick.

func NewAlignedTicker added in v1.15.0

func NewAlignedTicker(now time.Time, interval, jitter, offset time.Duration) *AlignedTicker

func (*AlignedTicker) Elapsed added in v1.15.0

func (t *AlignedTicker) Elapsed() <-chan time.Time

func (*AlignedTicker) Stop added in v1.15.0

func (t *AlignedTicker) Stop()

type MetricMaker

type MetricMaker interface {
	LogName() string
	MakeMetric(m telegraf.Metric) telegraf.Metric
	Log() telegraf.Logger
}

type RollingTicker added in v1.15.0

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

RollingTicker delivers ticks at regular but unaligned intervals.

Because the next interval is scheduled based on the interval + jitter, you are guaranteed at least interval seconds without missing a tick and ticks will be evenly scheduled over time.

On average you will have one collection each interval + (jitter/2).

The first tick is emitted after interval+jitter seconds.

Ticks are dropped for slow consumers.

func NewRollingTicker added in v1.15.0

func NewRollingTicker(interval, jitter time.Duration) *RollingTicker

func (*RollingTicker) Elapsed added in v1.15.0

func (t *RollingTicker) Elapsed() <-chan time.Time

func (*RollingTicker) Stop added in v1.15.0

func (t *RollingTicker) Stop()

type Ticker

type Ticker interface {
	Elapsed() <-chan time.Time
	Stop()
}

type UnalignedTicker added in v1.15.0

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

UnalignedTicker delivers ticks at regular but unaligned intervals. No effort is made to avoid drift.

The ticks may have an jitter duration applied to them as an random offset to the interval. However the overall pace of is that of the interval, so on average you will have one collection each interval.

The first tick is emitted immediately.

Ticks are dropped for slow consumers.

func NewUnalignedTicker added in v1.15.0

func NewUnalignedTicker(interval, jitter, offset time.Duration) *UnalignedTicker

func (*UnalignedTicker) Elapsed added in v1.15.0

func (t *UnalignedTicker) Elapsed() <-chan time.Time

func (*UnalignedTicker) InjectTick added in v1.15.0

func (t *UnalignedTicker) InjectTick()

func (*UnalignedTicker) Stop added in v1.15.0

func (t *UnalignedTicker) Stop()

Jump to

Keyboard shortcuts

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