metric

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 13 Imported by: 271

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrSkipTracking indicates that tracking information could not be found after
	// deserializing a metric from bytes. In this case we should skip the metric
	// and continue as if it does not exist.
	ErrSkipTracking = errors.New("metric tracking data not found")
)

storage for tracking data that can't be serialized to disk

Functions

func FromBytes added in v1.32.0

func FromBytes(b []byte) (telegraf.Metric, error)

func FromMetric

func FromMetric(other telegraf.Metric) telegraf.Metric

FromMetric returns a deep copy of the metric with any tracking information removed.

func Init added in v1.32.0

func Init()

func New

func New(
	name string,
	tags map[string]string,
	fields map[string]interface{},
	tm time.Time,
	tp ...telegraf.ValueType,
) telegraf.Metric

func ToBytes added in v1.32.0

func ToBytes(m telegraf.Metric) ([]byte, error)

func WithGroupTracking

func WithGroupTracking(metric []telegraf.Metric, fn NotifyFunc) ([]telegraf.Metric, telegraf.TrackingID)

WithGroupTracking adds tracking to the metrics and registers the notify function to be called when processing is complete.

func WithTracking

func WithTracking(metric telegraf.Metric, fn NotifyFunc) (telegraf.Metric, telegraf.TrackingID)

WithTracking adds tracking to the metric and registers the notify function to be called when processing is complete.

Types

type NotifyFunc

type NotifyFunc = func(track telegraf.DeliveryInfo)

NotifyFunc is called when a tracking metric is done being processed with the tracking information.

type SeriesGrouper

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

func NewSeriesGrouper

func NewSeriesGrouper() *SeriesGrouper

NewSeriesGrouper returns a type that can be used to group fields by series and time, so that fields which share these values will be combined into a single telegraf.Metric.

This is useful to build telegraf.Metric's when all fields for a series are not available at once.

ex: - cpu,host=localhost usage_time=42 - cpu,host=localhost idle_time=42 + cpu,host=localhost idle_time=42,usage_time=42

func (*SeriesGrouper) Add

func (g *SeriesGrouper) Add(
	measurement string,
	tags map[string]string,
	tm time.Time,
	field string,
	fieldValue interface{},
)

Add adds a field key and value to the series.

func (*SeriesGrouper) AddMetric added in v1.17.1

func (g *SeriesGrouper) AddMetric(
	metric telegraf.Metric,
)

AddMetric adds a metric to the series, merging with any previous matching metrics.

func (*SeriesGrouper) Metrics

func (g *SeriesGrouper) Metrics() []telegraf.Metric

Metrics returns the metrics grouped by series and time.

Jump to

Keyboard shortcuts

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