Documentation ¶
Index ¶
Constants ¶
const ( CounterInc = "inc" CounterAdd = "add" )
const ( GaugeSet = "set" GaugeInc = "inc" GaugeDec = "dec" GaugeAdd = "add" GaugeSub = "sub" ErrGaugeActionRequired = "gauge action must be defined as `set`, `inc`, `dec`, `add`, or `sub`" ErrGaugeInvalidAction = "action %s is not valid, action must be `set`, `inc`, `dec`, `add`, or `sub`" )
Variables ¶
var DefaultCounterConfig = CounterConfig{ MaxIdle: 5 * time.Minute, }
DefaultCounterConfig sets the default for a Counter.
var DefaultGaugeConfig = GaugeConfig{ MaxIdle: 5 * time.Minute, }
DefaultGaugeConfig sets the defaults for a Gauge.
var DefaultHistogramConfig = HistogramConfig{ MaxIdle: 5 * time.Minute, }
DefaultHistogramConfig sets the defaults for a Histogram.
Functions ¶
This section is empty.
Types ¶
type CounterConfig ¶
type CounterConfig struct { // Shared fields Name string `alloy:"name,attr"` Description string `alloy:"description,attr,optional"` Source string `alloy:"source,attr,optional"` Prefix string `alloy:"prefix,attr,optional"` MaxIdle time.Duration `alloy:"max_idle_duration,attr,optional"` Value string `alloy:"value,attr,optional"` // Counter-specific fields Action string `alloy:"action,attr"` MatchAll bool `alloy:"match_all,attr,optional"` CountEntryBytes bool `alloy:"count_entry_bytes,attr,optional"` }
CounterConfig defines a counter metric whose value only goes up.
func (*CounterConfig) SetToDefault ¶
func (c *CounterConfig) SetToDefault()
SetToDefault implements syntax.Defaulter.
func (*CounterConfig) Validate ¶
func (c *CounterConfig) Validate() error
Validate implements syntax.Validator.
type Counters ¶
type Counters struct { Cfg *CounterConfig // contains filtered or unexported fields }
Counters is a vector of counters for a log stream.
func NewCounters ¶
func NewCounters(name string, config *CounterConfig) (*Counters, error)
NewCounters creates a new counter vec.
func (Counters) Collect ¶
func (c Counters) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector
func (Counters) Describe ¶
func (c Counters) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"
type Expirable ¶
Expirable allows checking if something has exceeded the provided maxAge based on the provided currentTime
type GaugeConfig ¶
type GaugeConfig struct { // Shared fields Name string `alloy:"name,attr"` Description string `alloy:"description,attr,optional"` Source string `alloy:"source,attr,optional"` Prefix string `alloy:"prefix,attr,optional"` MaxIdle time.Duration `alloy:"max_idle_duration,attr,optional"` Value string `alloy:"value,attr,optional"` // Gauge-specific fields Action string `alloy:"action,attr"` }
GaugeConfig defines a gauge metric whose value can go up or down.
func (*GaugeConfig) SetToDefault ¶
func (g *GaugeConfig) SetToDefault()
SetToDefault implements syntax.Defaulter.
func (*GaugeConfig) Validate ¶
func (g *GaugeConfig) Validate() error
Validate implements syntax.Validator.
type Gauges ¶
type Gauges struct { Cfg *GaugeConfig // contains filtered or unexported fields }
Gauges is a vector of gauges for a log stream.
func NewGauges ¶
func NewGauges(name string, config *GaugeConfig) (*Gauges, error)
NewGauges creates a new gauge vec.
func (Gauges) Collect ¶
func (c Gauges) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector
func (Gauges) Describe ¶
func (c Gauges) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"
type HistogramConfig ¶
type HistogramConfig struct { // Shared fields Name string `alloy:"name,attr"` Description string `alloy:"description,attr,optional"` Source string `alloy:"source,attr,optional"` Prefix string `alloy:"prefix,attr,optional"` MaxIdle time.Duration `alloy:"max_idle_duration,attr,optional"` Value string `alloy:"value,attr,optional"` // Histogram-specific fields Buckets []float64 `alloy:"buckets,attr"` }
HistogramConfig defines a histogram metric whose values are bucketed.
func (*HistogramConfig) SetToDefault ¶
func (h *HistogramConfig) SetToDefault()
SetToDefault implements syntax.Defaulter.
func (*HistogramConfig) Validate ¶
func (h *HistogramConfig) Validate() error
Validate implements syntax.Validator.
type Histograms ¶
type Histograms struct { Cfg *HistogramConfig // contains filtered or unexported fields }
Histograms is a vector of histograms for a log stream.
func NewHistograms ¶
func NewHistograms(name string, config *HistogramConfig) (*Histograms, error)
NewHistograms creates a new histogram vec.
func (Histograms) Collect ¶
func (c Histograms) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector
func (Histograms) Describe ¶
func (c Histograms) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector and doesn't declare any metrics on purpose to bypass prometheus validation. see https://godoc.org/github.com/prometheus/client_golang/prometheus#hdr-Custom_Collectors_and_constant_Metrics search for "unchecked"
func (*Histograms) With ¶
func (h *Histograms) With(labels model.LabelSet) prometheus.Histogram
With returns the histogram associated with a stream labelset.