Documentation
¶
Index ¶
- Constants
- Variables
- func SetLoggerOnPlugin(i interface{}, logger telegraf.Logger)
- func ShouldPassFilters(include, exclude filter.Filter, key string) bool
- func ShouldTagsPass(passFilters, dropFilters []TagFilter, tags []*telegraf.Tag) bool
- type AggregatorConfig
- type Buffer
- type BufferStats
- type DiskBuffer
- type Filter
- type InputConfig
- type MemoryBuffer
- type OutputConfig
- type ParserConfig
- type ProcessorConfig
- type RunningAggregator
- func (r *RunningAggregator) Add(m telegraf.Metric) bool
- func (r *RunningAggregator) EndPeriod() time.Time
- func (r *RunningAggregator) ID() string
- func (r *RunningAggregator) Init() error
- func (r *RunningAggregator) Log() telegraf.Logger
- func (r *RunningAggregator) LogName() string
- func (r *RunningAggregator) MakeMetric(telegrafMetric 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) ID() string
- func (r *RunningInput) IncrGatherTimeouts()
- 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) Probe() error
- func (r *RunningInput) SetDefaultTags(tags map[string]string)
- func (r *RunningInput) Start(acc telegraf.Accumulator) error
- func (r *RunningInput) Stop()
- type RunningOutput
- func (r *RunningOutput) AddMetric(metric telegraf.Metric)
- func (r *RunningOutput) AddMetricNoCopy(metric telegraf.Metric)
- func (r *RunningOutput) BufferLength() int
- func (r *RunningOutput) Close()
- func (r *RunningOutput) Connect() error
- func (r *RunningOutput) ID() string
- 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 RunningParser
- func (r *RunningParser) Init() error
- func (r *RunningParser) Log() telegraf.Logger
- func (r *RunningParser) LogName() string
- func (r *RunningParser) Parse(buf []byte) ([]telegraf.Metric, error)
- func (r *RunningParser) ParseLine(line string) (telegraf.Metric, error)
- func (r *RunningParser) SetDefaultTags(tags map[string]string)
- type RunningProcessor
- func (rp *RunningProcessor) Add(m telegraf.Metric, acc telegraf.Accumulator) error
- func (rp *RunningProcessor) ID() string
- func (rp *RunningProcessor) Init() error
- func (rp *RunningProcessor) Log() telegraf.Logger
- func (rp *RunningProcessor) LogName() string
- func (*RunningProcessor) MakeMetric(metric telegraf.Metric) telegraf.Metric
- func (rp *RunningProcessor) Start(acc telegraf.Accumulator) error
- func (rp *RunningProcessor) Stop()
- type RunningProcessors
- type RunningSerializer
- type SerializerConfig
- type TagFilter
- type Transaction
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 ¶
var ( AgentMetricsWritten = selfstat.Register("agent", "metrics_written", make(map[string]string)) AgentMetricsRejected = selfstat.Register("agent", "metrics_rejected", make(map[string]string)) AgentMetricsDropped = selfstat.Register("agent", "metrics_dropped", make(map[string]string)) )
Functions ¶
func SetLoggerOnPlugin ¶ added in v1.15.4
func ShouldPassFilters ¶ added in v1.27.0
Types ¶
type AggregatorConfig ¶
type AggregatorConfig struct { Name string Source string Alias string ID string DropOriginal bool Period time.Duration Delay time.Duration Grace time.Duration LogLevel string NameOverride string MeasurementPrefix string MeasurementSuffix string Tags map[string]string Filter Filter }
AggregatorConfig is the common config for all aggregators.
type Buffer ¶
type Buffer interface { // Len returns the number of metrics currently in the buffer. Len() int // Add adds metrics to the buffer and returns number of dropped metrics. Add(metrics ...telegraf.Metric) int // Batch starts a transaction by returning a slice of metrics up to the // given batch-size starting from the oldest metric in the buffer. Metrics // are ordered from oldest to newest and must not be modified by the plugin. BeginTransaction(batchSize int) *Transaction // Flush ends a metric and persists the buffer state EndTransaction(*Transaction) // Stats returns the buffer statistics such as rejected, dropped and accepted metrics Stats() BufferStats // Close finalizes the buffer and closes all open resources Close() error }
type BufferStats ¶ added in v1.32.0
type BufferStats struct { MetricsAdded selfstat.Stat MetricsWritten selfstat.Stat MetricsRejected selfstat.Stat MetricsDropped selfstat.Stat BufferSize selfstat.Stat BufferLimit selfstat.Stat }
BufferStats holds common metrics used for buffer implementations. Implementations of Buffer should embed this struct in them.
func NewBufferStats ¶ added in v1.32.0
func NewBufferStats(name, alias string, capacity int) BufferStats
type DiskBuffer ¶ added in v1.32.0
type DiskBuffer struct { BufferStats sync.Mutex // contains filtered or unexported fields }
func NewDiskBuffer ¶ added in v1.32.0
func NewDiskBuffer(name, id, path string, stats BufferStats) (*DiskBuffer, error)
func (*DiskBuffer) BeginTransaction ¶ added in v1.33.0
func (b *DiskBuffer) BeginTransaction(batchSize int) *Transaction
func (*DiskBuffer) Close ¶ added in v1.32.3
func (b *DiskBuffer) Close() error
func (*DiskBuffer) EndTransaction ¶ added in v1.33.0
func (b *DiskBuffer) EndTransaction(tx *Transaction)
func (*DiskBuffer) Len ¶ added in v1.32.0
func (b *DiskBuffer) Len() int
func (*DiskBuffer) Stats ¶ added in v1.32.0
func (b *DiskBuffer) Stats() BufferStats
type Filter ¶
type Filter struct { NameDrop []string NameDropSeparators string NamePass []string NamePassSeparators string FieldExclude []string FieldInclude []string TagDropFilters []TagFilter TagPassFilters []TagFilter TagExclude []string TagInclude []string // New metric-filtering interface MetricPass string // contains filtered or unexported fields }
Filter containing drop/pass and include/exclude rules
type InputConfig ¶
type InputConfig struct { Name string Source string Alias string ID string Interval time.Duration CollectionJitter time.Duration CollectionOffset time.Duration Precision time.Duration TimeSource string StartupErrorBehavior string LogLevel string NameOverride string MeasurementPrefix string MeasurementSuffix string Tags map[string]string Filter Filter AlwaysIncludeLocalTags bool AlwaysIncludeGlobalTags bool }
InputConfig is the common config for all inputs.
type MemoryBuffer ¶ added in v1.32.0
type MemoryBuffer struct { sync.Mutex BufferStats // contains filtered or unexported fields }
MemoryBuffer stores metrics in a circular buffer.
func NewMemoryBuffer ¶ added in v1.32.0
func NewMemoryBuffer(capacity int, stats BufferStats) (*MemoryBuffer, error)
func (*MemoryBuffer) Add ¶ added in v1.32.0
func (b *MemoryBuffer) Add(metrics ...telegraf.Metric) int
func (*MemoryBuffer) BeginTransaction ¶ added in v1.33.0
func (b *MemoryBuffer) BeginTransaction(batchSize int) *Transaction
func (*MemoryBuffer) Close ¶ added in v1.32.3
func (*MemoryBuffer) Close() error
func (*MemoryBuffer) EndTransaction ¶ added in v1.33.0
func (b *MemoryBuffer) EndTransaction(tx *Transaction)
func (*MemoryBuffer) Len ¶ added in v1.32.0
func (b *MemoryBuffer) Len() int
func (*MemoryBuffer) Stats ¶ added in v1.32.0
func (b *MemoryBuffer) Stats() BufferStats
type OutputConfig ¶
type OutputConfig struct { Name string Source string Alias string ID string StartupErrorBehavior string Filter Filter FlushInterval time.Duration FlushJitter time.Duration MetricBufferLimit int MetricBatchSize int NameOverride string NamePrefix string NameSuffix string BufferStrategy string BufferDirectory string LogLevel string }
OutputConfig containing name and filter
type ParserConfig ¶ added in v1.22.0
type ParserConfig struct { Parent string Alias string DataFormat string DefaultTags map[string]string LogLevel string }
ParserConfig is the common config for all parsers.
type ProcessorConfig ¶
type ProcessorConfig struct { Name string Source string Alias string ID string Order int64 Filter Filter LogLevel string }
ProcessorConfig 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) ID ¶ added in v1.26.0
func (r *RunningAggregator) ID() string
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(telegrafMetric 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 GatherTimeouts selfstat.Stat StartupErrors 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) ID ¶ added in v1.26.0
func (r *RunningInput) ID() string
func (*RunningInput) IncrGatherTimeouts ¶ added in v1.28.0
func (r *RunningInput) IncrGatherTimeouts()
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) Probe ¶ added in v1.34.0
func (r *RunningInput) Probe() error
func (*RunningInput) SetDefaultTags ¶
func (r *RunningInput) SetDefaultTags(tags map[string]string)
func (*RunningInput) Start ¶ added in v1.31.0
func (r *RunningInput) Start(acc telegraf.Accumulator) error
func (*RunningInput) Stop ¶ added in v1.31.0
func (r *RunningInput) Stop()
type RunningOutput ¶
type RunningOutput struct { Output telegraf.Output Config *OutputConfig MetricBufferLimit int MetricBatchSize int MetricsFiltered selfstat.Stat WriteTime selfstat.Stat StartupErrors 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, bufferLimit int) *RunningOutput
func (*RunningOutput) AddMetric ¶
func (r *RunningOutput) AddMetric(metric telegraf.Metric)
AddMetric adds a metric to the output. The given metric will be copied if the output selects the metric.
func (*RunningOutput) AddMetricNoCopy ¶ added in v1.33.0
func (r *RunningOutput) AddMetricNoCopy(metric telegraf.Metric)
AddMetricNoCopy adds a metric to the output. Takes ownership of metric regardless of whether the output selects it for outputting.
func (*RunningOutput) BufferLength ¶
func (r *RunningOutput) BufferLength() int
func (*RunningOutput) Connect ¶ added in v1.31.0
func (r *RunningOutput) Connect() error
func (*RunningOutput) ID ¶ added in v1.26.0
func (r *RunningOutput) ID() string
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 RunningParser ¶ added in v1.22.0
type RunningParser struct { Parser telegraf.Parser Config *ParserConfig MetricsParsed selfstat.Stat ParseTime selfstat.Stat // contains filtered or unexported fields }
func NewRunningParser ¶ added in v1.22.0
func NewRunningParser(parser telegraf.Parser, config *ParserConfig) *RunningParser
func (*RunningParser) Init ¶ added in v1.22.0
func (r *RunningParser) Init() error
func (*RunningParser) Log ¶ added in v1.22.0
func (r *RunningParser) Log() telegraf.Logger
func (*RunningParser) LogName ¶ added in v1.22.0
func (r *RunningParser) LogName() string
func (*RunningParser) Parse ¶ added in v1.22.0
func (r *RunningParser) Parse(buf []byte) ([]telegraf.Metric, error)
func (*RunningParser) ParseLine ¶ added in v1.22.0
func (r *RunningParser) ParseLine(line string) (telegraf.Metric, error)
func (*RunningParser) SetDefaultTags ¶ added in v1.22.0
func (r *RunningParser) SetDefaultTags(tags map[string]string)
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) ID ¶ added in v1.26.0
func (rp *RunningProcessor) ID() string
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 (*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)
type RunningSerializer ¶ added in v1.27.0
type RunningSerializer struct { Serializer telegraf.Serializer Config *SerializerConfig MetricsSerialized selfstat.Stat BytesSerialized selfstat.Stat SerializationTime selfstat.Stat // contains filtered or unexported fields }
func NewRunningSerializer ¶ added in v1.27.0
func NewRunningSerializer(serializer telegraf.Serializer, config *SerializerConfig) *RunningSerializer
func (*RunningSerializer) Init ¶ added in v1.27.0
func (r *RunningSerializer) Init() error
func (*RunningSerializer) Log ¶ added in v1.27.0
func (r *RunningSerializer) Log() telegraf.Logger
func (*RunningSerializer) LogName ¶ added in v1.27.0
func (r *RunningSerializer) LogName() string
func (*RunningSerializer) Serialize ¶ added in v1.27.0
func (r *RunningSerializer) Serialize(metric telegraf.Metric) ([]byte, error)
func (*RunningSerializer) SerializeBatch ¶ added in v1.27.0
func (r *RunningSerializer) SerializeBatch(metrics []telegraf.Metric) ([]byte, error)
type SerializerConfig ¶ added in v1.27.0
type SerializerConfig struct { Parent string Alias string DataFormat string DefaultTags map[string]string LogLevel string }
SerializerConfig is the common config for all serializers.
type Transaction ¶ added in v1.33.0
type Transaction struct { // Batch of metrics to write Batch []telegraf.Metric // Accept denotes the indices of metrics that were successfully written Accept []int // Reject denotes the indices of metrics that were not written but should // not be requeued Reject []int // contains filtered or unexported fields }
func (*Transaction) AcceptAll ¶ added in v1.33.0
func (tx *Transaction) AcceptAll()
func (*Transaction) InferKeep ¶ added in v1.33.0
func (tx *Transaction) InferKeep() []int
func (*Transaction) KeepAll ¶ added in v1.33.0
func (*Transaction) KeepAll()