Documentation ¶
Index ¶
- Constants
- Variables
- func SetLoggerOnPlugin(i interface{}, log telegraf.Logger)
- type AggregatorConfig
- type Buffer
- type Filter
- type InputConfig
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) OnErr(f func())
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- type OutputConfig
- type ProcessorConfig
- type RunningAggregator
- func (r *RunningAggregator) Add(m telegraf.Metric) bool
- func (r *RunningAggregator) EndPeriod() time.Time
- func (r *RunningAggregator) Init() error
- func (r *RunningAggregator) Log() telegraf.Logger
- func (r *RunningAggregator) LogName() string
- func (r *RunningAggregator) MakeMetric(metric telegraf.Metric) telegraf.Metric
- func (r *RunningAggregator) Period() time.Duration
- func (r *RunningAggregator) Push(acc telegraf.Accumulator)
- func (r *RunningAggregator) UpdateWindow(start, until time.Time)
- type RunningInput
- func (r *RunningInput) Gather(acc telegraf.Accumulator) error
- func (r *RunningInput) Init() error
- func (r *RunningInput) Log() telegraf.Logger
- func (r *RunningInput) LogName() string
- func (r *RunningInput) MakeMetric(metric telegraf.Metric) telegraf.Metric
- func (r *RunningInput) SetDefaultTags(tags map[string]string)
- type RunningOutput
- func (r *RunningOutput) AddMetric(metric telegraf.Metric)
- func (r *RunningOutput) BufferLength() int
- func (r *RunningOutput) Close()
- func (r *RunningOutput) Init() error
- func (r *RunningOutput) Log() telegraf.Logger
- func (r *RunningOutput) LogBufferStatus()
- func (r *RunningOutput) LogName() string
- func (r *RunningOutput) Write() error
- func (r *RunningOutput) WriteBatch() error
- type RunningProcessor
- func (rp *RunningProcessor) Add(m telegraf.Metric, acc telegraf.Accumulator) error
- func (rp *RunningProcessor) Init() error
- func (rp *RunningProcessor) Log() telegraf.Logger
- func (rp *RunningProcessor) LogName() string
- func (rp *RunningProcessor) MakeMetric(metric telegraf.Metric) telegraf.Metric
- func (rp *RunningProcessor) Start(acc telegraf.Accumulator) error
- func (rp *RunningProcessor) Stop()
- type RunningProcessors
- type TagFilter
Constants ¶
const ( // Default size of metrics batch size. DefaultMetricBatchSize = 1000 // Default number of metrics kept. It should be a multiple of batch size. DefaultMetricBufferLimit = 10000 )
Variables ¶
Functions ¶
func SetLoggerOnPlugin ¶ added in v1.15.4
Types ¶
type AggregatorConfig ¶
type AggregatorConfig struct { Name string Alias string DropOriginal bool Period time.Duration Delay time.Duration Grace time.Duration NameOverride string MeasurementPrefix string MeasurementSuffix string Tags map[string]string Filter Filter }
AggregatorConfig is the common config for all aggregators.
type Buffer ¶
type Buffer struct { sync.Mutex MetricsAdded selfstat.Stat MetricsWritten selfstat.Stat MetricsDropped selfstat.Stat BufferSize selfstat.Stat BufferLimit selfstat.Stat // contains filtered or unexported fields }
Buffer stores metrics in a circular buffer.
func (*Buffer) Batch ¶
Batch returns a slice containing up to batchSize of the oldest metrics not yet dropped. Metrics are ordered from oldest to newest in the batch. The batch must not be modified by the client.
type Filter ¶
type Filter struct { NameDrop []string NamePass []string FieldDrop []string FieldPass []string TagDrop []TagFilter TagPass []TagFilter TagExclude []string TagInclude []string // contains filtered or unexported fields }
Filter containing drop/pass and tagdrop/tagpass rules
type InputConfig ¶
type InputConfig struct { Name string Alias string Interval time.Duration CollectionJitter time.Duration Precision time.Duration NameOverride string MeasurementPrefix string MeasurementSuffix string Tags map[string]string Filter Filter }
InputConfig is the common config for all inputs.
type Logger ¶
type Logger struct { OnErrs []func() Name string // Name is the plugin name, will be printed in the `[]`. }
Logger defines a logging structure for plugins.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug logs a debug message, patterned after log.Print.
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error logs an error message, patterned after log.Print.
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info logs an information message, patterned after log.Print.
func (*Logger) OnErr ¶
func (l *Logger) OnErr(f func())
OnErr defines a callback that triggers only when errors are about to be written to the log
type OutputConfig ¶
type OutputConfig struct { Name string Alias string Filter Filter FlushInterval time.Duration FlushJitter time.Duration MetricBufferLimit int MetricBatchSize int NameOverride string NamePrefix string NameSuffix string }
OutputConfig containing name and filter
type ProcessorConfig ¶
FilterConfig containing a name and filter
type RunningAggregator ¶
type RunningAggregator struct { sync.Mutex Aggregator telegraf.Aggregator Config *AggregatorConfig MetricsPushed selfstat.Stat MetricsFiltered selfstat.Stat MetricsDropped selfstat.Stat PushTime selfstat.Stat // contains filtered or unexported fields }
func NewRunningAggregator ¶
func NewRunningAggregator(aggregator telegraf.Aggregator, config *AggregatorConfig) *RunningAggregator
func (*RunningAggregator) Add ¶
func (r *RunningAggregator) Add(m telegraf.Metric) bool
Add a metric to the aggregator and return true if the original metric should be dropped.
func (*RunningAggregator) EndPeriod ¶
func (r *RunningAggregator) EndPeriod() time.Time
func (*RunningAggregator) Init ¶
func (r *RunningAggregator) Init() error
func (*RunningAggregator) Log ¶
func (r *RunningAggregator) Log() telegraf.Logger
func (*RunningAggregator) LogName ¶
func (r *RunningAggregator) LogName() string
func (*RunningAggregator) MakeMetric ¶
func (r *RunningAggregator) MakeMetric(metric telegraf.Metric) telegraf.Metric
func (*RunningAggregator) Period ¶
func (r *RunningAggregator) Period() time.Duration
func (*RunningAggregator) Push ¶
func (r *RunningAggregator) Push(acc telegraf.Accumulator)
func (*RunningAggregator) UpdateWindow ¶
func (r *RunningAggregator) UpdateWindow(start, until time.Time)
type RunningInput ¶
type RunningInput struct { Input telegraf.Input Config *InputConfig MetricsGathered selfstat.Stat GatherTime selfstat.Stat // contains filtered or unexported fields }
func NewRunningInput ¶
func NewRunningInput(input telegraf.Input, config *InputConfig) *RunningInput
func (*RunningInput) Gather ¶
func (r *RunningInput) Gather(acc telegraf.Accumulator) error
func (*RunningInput) Init ¶
func (r *RunningInput) Init() error
func (*RunningInput) Log ¶
func (r *RunningInput) Log() telegraf.Logger
func (*RunningInput) LogName ¶
func (r *RunningInput) LogName() string
func (*RunningInput) MakeMetric ¶
func (r *RunningInput) MakeMetric(metric telegraf.Metric) telegraf.Metric
func (*RunningInput) SetDefaultTags ¶
func (r *RunningInput) SetDefaultTags(tags map[string]string)
type RunningOutput ¶
type RunningOutput struct { Output telegraf.Output Config *OutputConfig MetricBufferLimit int MetricBatchSize int MetricsFiltered selfstat.Stat WriteTime selfstat.Stat BatchReady chan time.Time // contains filtered or unexported fields }
RunningOutput contains the output configuration
func NewRunningOutput ¶
func NewRunningOutput( output telegraf.Output, config *OutputConfig, batchSize int, bufferLimit int, ) *RunningOutput
func (*RunningOutput) AddMetric ¶
func (r *RunningOutput) AddMetric(metric telegraf.Metric)
AddMetric adds a metric to the output.
Takes ownership of metric
func (*RunningOutput) BufferLength ¶
func (r *RunningOutput) BufferLength() int
func (*RunningOutput) Init ¶
func (r *RunningOutput) Init() error
func (*RunningOutput) Log ¶
func (r *RunningOutput) Log() telegraf.Logger
func (*RunningOutput) LogBufferStatus ¶
func (r *RunningOutput) LogBufferStatus()
func (*RunningOutput) LogName ¶
func (r *RunningOutput) LogName() string
func (*RunningOutput) Write ¶
func (r *RunningOutput) Write() error
Write writes all metrics to the output, stopping when all have been sent on or error.
func (*RunningOutput) WriteBatch ¶
func (r *RunningOutput) WriteBatch() error
WriteBatch writes a single batch of metrics to the output.
type RunningProcessor ¶
type RunningProcessor struct { sync.Mutex Processor telegraf.StreamingProcessor Config *ProcessorConfig // contains filtered or unexported fields }
func NewRunningProcessor ¶
func NewRunningProcessor(processor telegraf.StreamingProcessor, config *ProcessorConfig) *RunningProcessor
func (*RunningProcessor) Add ¶
func (rp *RunningProcessor) Add(m telegraf.Metric, acc telegraf.Accumulator) error
func (*RunningProcessor) Init ¶
func (rp *RunningProcessor) Init() error
func (*RunningProcessor) Log ¶
func (rp *RunningProcessor) Log() telegraf.Logger
func (*RunningProcessor) LogName ¶
func (rp *RunningProcessor) LogName() string
func (*RunningProcessor) MakeMetric ¶
func (rp *RunningProcessor) MakeMetric(metric telegraf.Metric) telegraf.Metric
func (*RunningProcessor) Start ¶
func (rp *RunningProcessor) Start(acc telegraf.Accumulator) error
func (*RunningProcessor) Stop ¶
func (rp *RunningProcessor) Stop()
type RunningProcessors ¶
type RunningProcessors []*RunningProcessor
func (RunningProcessors) Len ¶
func (rp RunningProcessors) Len() int
func (RunningProcessors) Less ¶
func (rp RunningProcessors) Less(i, j int) bool
func (RunningProcessors) Swap ¶
func (rp RunningProcessors) Swap(i, j int)