models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 9 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 GlobalMetricsGathered = selfstat.Register("agent", "metrics_gathered", map[string]string{})

Functions

This section is empty.

Types

type AggregatorConfig added in v1.2.0

type AggregatorConfig struct {
	Name string

	DropOriginal      bool
	NameOverride      string
	MeasurementPrefix string
	MeasurementSuffix string
	Tags              map[string]string
	Filter            Filter

	Period time.Duration
	Delay  time.Duration
}

AggregatorConfig containing configuration parameters for the running aggregator plugin.

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) Apply added in v1.2.0

func (f *Filter) Apply(
	measurement string,
	fields map[string]interface{},
	tags map[string]string,
) bool

Apply applies the filter to the given measurement name, fields map, and tags map. It will return false if the metric should be "filtered out", and true if the metric should "pass". It will modify tags & fields in-place if they need to be deleted.

func (*Filter) Compile added in v1.2.0

func (f *Filter) Compile() error

Compile all Filter lists into filter.Filter objects.

func (*Filter) IsActive

func (f *Filter) IsActive() bool

type InputConfig

type InputConfig struct {
	Name              string
	NameOverride      string
	MeasurementPrefix string
	MeasurementSuffix string
	Tags              map[string]string
	Filter            Filter
	Interval          time.Duration
}

InputConfig containing a name, interval, and filter

type OutputConfig

type OutputConfig struct {
	Name   string
	Filter Filter
}

OutputConfig containing name and filter

type ProcessorConfig added in v1.2.0

type ProcessorConfig struct {
	Name   string
	Order  int64
	Filter Filter
}

FilterConfig containing a name and filter

type RunningAggregator added in v1.2.0

type RunningAggregator struct {
	Config *AggregatorConfig
	// contains filtered or unexported fields
}

func NewRunningAggregator added in v1.2.0

func NewRunningAggregator(
	a telegraf.Aggregator,
	conf *AggregatorConfig,
) *RunningAggregator

func (*RunningAggregator) Add added in v1.2.0

Add applies the given metric to the aggregator. Before applying to the plugin, it will run any defined filters on the metric. Apply returns true if the original metric should be dropped.

func (*RunningAggregator) MakeMetric added in v1.2.0

func (r *RunningAggregator) MakeMetric(
	measurement string,
	fields map[string]interface{},
	tags map[string]string,
	mType telegraf.ValueType,
	t time.Time,
) telegraf.Metric

func (*RunningAggregator) Name added in v1.2.0

func (r *RunningAggregator) Name() string

func (*RunningAggregator) Run added in v1.2.0

func (r *RunningAggregator) Run(
	acc telegraf.Accumulator,
	shutdown chan struct{},
)

Run runs the running aggregator, listens for incoming metrics, and waits for period ticks to tell it when to push and reset the aggregator.

type RunningInput

type RunningInput struct {
	Input  telegraf.Input
	Config *InputConfig

	MetricsGathered selfstat.Stat
	// contains filtered or unexported fields
}

func NewRunningInput added in v1.2.0

func NewRunningInput(
	input telegraf.Input,
	config *InputConfig,
) *RunningInput

func (*RunningInput) MakeMetric added in v1.2.0

func (r *RunningInput) MakeMetric(
	measurement string,
	fields map[string]interface{},
	tags map[string]string,
	mType telegraf.ValueType,
	t time.Time,
) telegraf.Metric

MakeMetric either returns a metric, or returns nil if the metric doesn't need to be created (because of filtering, an error, etc.)

func (*RunningInput) Name

func (r *RunningInput) Name() string

func (*RunningInput) SetDefaultTags added in v1.2.0

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

func (*RunningInput) SetTrace added in v1.2.0

func (r *RunningInput) SetTrace(trace bool)

func (*RunningInput) Trace added in v1.2.0

func (r *RunningInput) Trace() bool

type RunningOutput

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

	MetricsFiltered selfstat.Stat
	MetricsWritten  selfstat.Stat
	BufferSize      selfstat.Stat
	BufferLimit     selfstat.Stat
	WriteTime       selfstat.Stat
	// 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 added in v1.2.0

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

AddMetric adds a metric to the output. This function can also write cached points if FlushBufferWhenFull is true.

func (*RunningOutput) Write

func (ro *RunningOutput) Write() error

Write writes all cached points to this output.

type RunningProcessor added in v1.2.0

type RunningProcessor struct {
	Name      string
	Processor telegraf.Processor
	Config    *ProcessorConfig
}

func (*RunningProcessor) Apply added in v1.2.0

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

type RunningProcessors added in v1.2.0

type RunningProcessors []*RunningProcessor

func (RunningProcessors) Len added in v1.2.0

func (rp RunningProcessors) Len() int

func (RunningProcessors) Less added in v1.2.0

func (rp RunningProcessors) Less(i, j int) bool

func (RunningProcessors) Swap added in v1.2.0

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