v1

package
v1.24.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector struct {
	ExpirationInterval time.Duration
	StringAsLabel      bool
	ExportTimestamp    bool
	Log                telegraf.Logger

	sync.Mutex
	// contains filtered or unexported fields
}

func NewCollector

func NewCollector(expire time.Duration, stringsAsLabel bool, logger telegraf.Logger) *Collector

func (*Collector) Add

func (c *Collector) Add(metrics []telegraf.Metric) error

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

func (*Collector) Expire

func (c *Collector) Expire(now time.Time, age time.Duration)

type MetricFamily

type MetricFamily struct {
	// Samples are the Sample belonging to this MetricFamily.
	Samples map[SampleID]*Sample
	// Need the telegraf ValueType because there isn't a Prometheus ValueType
	// representing Histogram or Summary
	TelegrafValueType telegraf.ValueType
	// LabelSet is the label counts for all Samples.
	LabelSet map[string]int
}

MetricFamily contains the data required to build valid prometheus Metrics.

type Sample

type Sample struct {
	// Labels are the Prometheus labels.
	Labels map[string]string
	// Value is the value in the Prometheus output. Only one of these will populated.
	Value          float64
	HistogramValue map[float64]uint64
	SummaryValue   map[float64]float64
	// Histograms and Summaries need a count and a sum
	Count uint64
	Sum   float64
	// Metric timestamp
	Timestamp time.Time
	// Expiration is the deadline that this Sample is valid until.
	Expiration time.Time
}

Sample represents the current value of a series.

type SampleID

type SampleID string

SampleID uniquely identifies a Sample

func CreateSampleID

func CreateSampleID(tags map[string]string) SampleID

CreateSampleID creates a SampleID based on the tags of a telegraf.Metric.

Jump to

Keyboard shortcuts

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