models

package
v1.0.0-...-47f3d97 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default size of metrics batch size.
	DEFAULT_METRIC_BATCH_SIZE = 1000

	// Default number of metrics kept. It should be a multiple of batch size.
	DEFAULT_METRIC_BUFFER_LIMIT = 10000
)

Variables

View Source
var (
	AgentMetricsWritten = selfstat.Register("agent", "metrics_written", map[string]string{})
	AgentMetricsDropped = selfstat.Register("agent", "metrics_dropped", map[string]string{})
)
View Source
var GlobalMetricsGathered = selfstat.Register("agent", "metrics_gathered", map[string]string{})

Functions

This section is empty.

Types

type AggregatorConfig

type AggregatorConfig struct {
	Name         string
	DropOriginal bool
	Period       time.Duration
	Delay        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
	// contains filtered or unexported fields
}

Buffer stores metrics in a circular buffer.

func NewBuffer

func NewBuffer(name string, capacity int) *Buffer

NewBuffer returns a new empty Buffer with the given capacity.

func (*Buffer) Accept

func (b *Buffer) Accept(batch []telegraf.Metric)

Accept marks the batch, acquired from Batch(), as successfully written.

func (*Buffer) Add

func (b *Buffer) Add(metrics ...telegraf.Metric)

Add adds metrics to the buffer

func (*Buffer) Batch

func (b *Buffer) Batch(batchSize int) []telegraf.Metric

Batch returns a slice containing up to batchSize of the most recently added metrics. Metrics are ordered from newest to oldest in the batch. The batch must not be modified by the client.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the number of metrics currently in the buffer.

func (*Buffer) Reject

func (b *Buffer) Reject(batch []telegraf.Metric)

Reject returns the batch, acquired from Batch(), to the buffer and marks it as unsent.

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

func (*Filter) Compile

func (f *Filter) Compile() error

Compile all Filter lists into filter.Filter objects.

func (*Filter) IsActive

func (f *Filter) IsActive() bool

IsActive checking if filter is active

func (*Filter) Modify

func (f *Filter) Modify(metric telegraf.Metric)

Modify removes any tags and fields from the metric according to the fieldpass/fielddrop and taginclude/tagexclude filters.

func (*Filter) Select

func (f *Filter) Select(metric telegraf.Metric) bool

Select returns true if the metric matches according to the namepass/namedrop and tagpass/tagdrop filters. The metric is not modified.

type InputConfig

type InputConfig struct {
	Name     string
	Interval time.Duration

	NameOverride      string
	MeasurementPrefix string
	MeasurementSuffix string
	Tags              map[string]string
	Filter            Filter
}

InputConfig is the common config for all inputs.

type OutputConfig

type OutputConfig struct {
	Name   string
	Filter Filter

	FlushInterval     time.Duration
	MetricBufferLimit int
	MetricBatchSize   int
}

OutputConfig containing name and filter

type ProcessorConfig

type ProcessorConfig struct {
	Name   string
	Order  int64
	Filter Filter
}

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(metric telegraf.Metric) bool

Add a metric to the aggregator and return true if the original metric should be dropped.

func (*RunningAggregator) MakeMetric

func (r *RunningAggregator) MakeMetric(metric telegraf.Metric) telegraf.Metric

func (*RunningAggregator) Name

func (r *RunningAggregator) Name() string

func (*RunningAggregator) Period

func (r *RunningAggregator) Period() time.Duration

func (*RunningAggregator) Push

func (r *RunningAggregator) Push(acc telegraf.Accumulator)

func (*RunningAggregator) SetPeriodStart

func (r *RunningAggregator) SetPeriodStart(start 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) MakeMetric

func (r *RunningInput) MakeMetric(metric telegraf.Metric) telegraf.Metric

func (*RunningInput) Name

func (r *RunningInput) Name() string

func (*RunningInput) SetDefaultTags

func (r *RunningInput) SetDefaultTags(tags map[string]string)

type RunningOutput

type RunningOutput struct {
	Name              string
	Output            telegraf.Output
	Config            *OutputConfig
	MetricBufferLimit int
	MetricBatchSize   int

	MetricsFiltered selfstat.Stat
	BufferSize      selfstat.Stat
	BufferLimit     selfstat.Stat
	WriteTime       selfstat.Stat

	BatchReady chan time.Time
	// contains filtered or unexported fields
}

RunningOutput contains the output configuration

func NewRunningOutput

func NewRunningOutput(
	name string,
	output telegraf.Output,
	conf *OutputConfig,
	batchSize int,
	bufferLimit int,
) *RunningOutput

func (*RunningOutput) AddMetric

func (ro *RunningOutput) AddMetric(metric telegraf.Metric)

AddMetric adds a metric to the output.

Takes ownership of metric

func (*RunningOutput) LogBufferStatus

func (ro *RunningOutput) LogBufferStatus()

func (*RunningOutput) Write

func (ro *RunningOutput) Write() error

Write writes all metrics to the output, stopping when all have been sent on or error.

func (*RunningOutput) WriteBatch

func (ro *RunningOutput) WriteBatch() error

WriteBatch writes only the batch metrics to the output.

type RunningProcessor

type RunningProcessor struct {
	Name string

	sync.Mutex
	Processor telegraf.Processor
	Config    *ProcessorConfig
}

func (*RunningProcessor) Apply

func (rp *RunningProcessor) Apply(in ...telegraf.Metric) []telegraf.Metric

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 TagFilter

type TagFilter struct {
	Name   string
	Filter []string
	// contains filtered or unexported fields
}

TagFilter is the name of a tag, and the values on which to filter

Jump to

Keyboard shortcuts

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