metric

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableDebugFinalizer

func EnableDebugFinalizer()

func FromMetric

func FromMetric(other cua.Metric) cua.Metric

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

func New

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

func WithGroupTracking

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

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

func WithTracking

func WithTracking(metric cua.Metric, fn NotifyFunc) (cua.Metric, cua.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 cua.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 cua.Metric.

This is useful to build cua.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{},
) error

Add adds a field key and value to the series.

func (*SeriesGrouper) Metrics

func (g *SeriesGrouper) Metrics() []cua.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