Documentation ¶
Index ¶
- func ReverseLabelledPath(path string) (name string, tagNames, tagValues []string)
- type Config
- type DudStat
- type DudType
- func (d DudType) Close() error
- func (d DudType) GetCounter(path string) StatCounter
- func (d DudType) GetCounterVec(path string, n ...string) StatCounterVec
- func (d DudType) GetGauge(path string) StatGauge
- func (d DudType) GetGaugeVec(path string, n ...string) StatGaugeVec
- func (d DudType) GetTimer(path string) StatTimer
- func (d DudType) GetTimerVec(path string, n ...string) StatTimerVec
- func (d DudType) HandlerFunc() http.HandlerFunc
- type Local
- func (l *Local) Close() error
- func (l *Local) FlushCounters() map[string]int64
- func (l *Local) FlushTimings() map[string]metrics.Timer
- func (l *Local) GetCounter(path string) StatCounter
- func (l *Local) GetCounterVec(path string, k ...string) StatCounterVec
- func (l *Local) GetCounters() map[string]int64
- func (l *Local) GetGauge(path string) StatGauge
- func (l *Local) GetGaugeVec(path string, k ...string) StatGaugeVec
- func (l *Local) GetTimer(path string) StatTimer
- func (l *Local) GetTimerVec(path string, k ...string) StatTimerVec
- func (l *Local) GetTimings() map[string]metrics.Timer
- func (l *Local) HandlerFunc() http.HandlerFunc
- type LocalStat
- type LocalTiming
- type Mapping
- type Namespaced
- func (n *Namespaced) Child() Type
- func (n *Namespaced) Close() error
- func (n *Namespaced) GetCounter(path string) StatCounter
- func (n *Namespaced) GetCounterVec(path string, labelNames ...string) StatCounterVec
- func (n *Namespaced) GetGauge(path string) StatGauge
- func (n *Namespaced) GetGaugeVec(path string, labelNames ...string) StatGaugeVec
- func (n *Namespaced) GetTimer(path string) StatTimer
- func (n *Namespaced) GetTimerVec(path string, labelNames ...string) StatTimerVec
- func (n *Namespaced) HandlerFunc() http.HandlerFunc
- func (n *Namespaced) WithLabels(labels ...string) *Namespaced
- func (n *Namespaced) WithMapping(m *Mapping) *Namespaced
- func (n *Namespaced) WithStats(s Type) *Namespaced
- type StatCounter
- type StatCounterVec
- type StatGauge
- type StatGaugeVec
- type StatTimer
- type StatTimerVec
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReverseLabelledPath ¶
ReverseLabelledPath extracts a name, tag names and tag values from a labelled metric name.
Types ¶
type Config ¶
type Config struct { Type string `json:"type" yaml:"type"` Mapping string `json:"mapping" yaml:"mapping"` Plugin any `json:"plugin,omitempty" yaml:"plugin,omitempty"` }
Config is the all encompassing configuration struct for all metric output types.
type DudStat ¶
type DudStat struct{}
DudStat implements the Stat interface but doesn't actual do anything.
func (DudStat) DecrFloat64 ¶ added in v4.23.0
DecrFloat64 does nothing
func (DudStat) IncrFloat64 ¶ added in v4.23.0
IncrFloat64 does nothing
func (DudStat) SetFloat64 ¶ added in v4.23.0
SetFloat64 does nothing
type DudType ¶
type DudType struct {
ID int
}
DudType implements the Type interface but doesn't actual do anything.
func (DudType) GetCounter ¶
func (d DudType) GetCounter(path string) StatCounter
GetCounter returns a DudStat.
func (DudType) GetCounterVec ¶
func (d DudType) GetCounterVec(path string, n ...string) StatCounterVec
GetCounterVec returns a DudStat.
func (DudType) GetGaugeVec ¶
func (d DudType) GetGaugeVec(path string, n ...string) StatGaugeVec
GetGaugeVec returns a DudStat.
func (DudType) GetTimerVec ¶
func (d DudType) GetTimerVec(path string, n ...string) StatTimerVec
GetTimerVec returns a DudStat.
func (DudType) HandlerFunc ¶
func (d DudType) HandlerFunc() http.HandlerFunc
HandlerFunc returns nil.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a metrics aggregator that stores metrics locally.
func (*Local) Close ¶
Close stops the Local object from aggregating metrics and cleans up resources.
func (*Local) FlushCounters ¶
FlushCounters returns a map of the current state of the metrics paths to counters and then resets the counters to 0.
func (*Local) FlushTimings ¶
FlushTimings returns a map of the current state of the metrics paths to counters and then resets the counters to 0.
func (*Local) GetCounter ¶
func (l *Local) GetCounter(path string) StatCounter
GetCounter returns a stat counter object for a path.
func (*Local) GetCounterVec ¶
func (l *Local) GetCounterVec(path string, k ...string) StatCounterVec
GetCounterVec returns a stat counter object for a path and records the labels and values.
func (*Local) GetCounters ¶
GetCounters returns a map of metric paths to counters.
func (*Local) GetGaugeVec ¶
func (l *Local) GetGaugeVec(path string, k ...string) StatGaugeVec
GetGaugeVec returns a stat timer object for a path with the labels discarded.
func (*Local) GetTimerVec ¶
func (l *Local) GetTimerVec(path string, k ...string) StatTimerVec
GetTimerVec returns a stat timer object for a path with the labels and values.
func (*Local) GetTimings ¶
GetTimings returns a map of metric paths to timers.
type LocalStat ¶
type LocalStat struct {
Value *int64
}
LocalStat is a representation of a single metric stat. Interactions with this stat are thread safe.
func (*LocalStat) DecrFloat64 ¶ added in v4.23.0
func (*LocalStat) IncrFloat64 ¶ added in v4.23.0
func (*LocalStat) SetFloat64 ¶ added in v4.23.0
type LocalTiming ¶
type LocalTiming struct {
// contains filtered or unexported fields
}
LocalTiming is a representation of a single metric timing.
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
Mapping is a compiled Bloblang mapping used to rewrite metrics.
func NewMapping ¶
NewMapping parses a Bloblang mapping and returns a metrics mapping.
type Namespaced ¶
type Namespaced struct {
// contains filtered or unexported fields
}
Namespaced wraps a child metrics exporter and exposes a Type API that adds namespacing labels and name prefixes to new.
func NewNamespaced ¶
func NewNamespaced(child Type) *Namespaced
NewNamespaced wraps a metrics exporter and adds prefixes and custom labels.
func (*Namespaced) Child ¶
func (n *Namespaced) Child() Type
Child returns the underlying metrics type.
func (*Namespaced) Close ¶
func (n *Namespaced) Close() error
Close stops aggregating stats and cleans up resources.
func (*Namespaced) GetCounter ¶
func (n *Namespaced) GetCounter(path string) StatCounter
GetCounter returns an editable counter stat for a given path.
func (*Namespaced) GetCounterVec ¶
func (n *Namespaced) GetCounterVec(path string, labelNames ...string) StatCounterVec
GetCounterVec returns an editable counter stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) GetGauge ¶
func (n *Namespaced) GetGauge(path string) StatGauge
GetGauge returns an editable gauge stat for a given path.
func (*Namespaced) GetGaugeVec ¶
func (n *Namespaced) GetGaugeVec(path string, labelNames ...string) StatGaugeVec
GetGaugeVec returns an editable gauge stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) GetTimer ¶
func (n *Namespaced) GetTimer(path string) StatTimer
GetTimer returns an editable timer stat for a given path.
func (*Namespaced) GetTimerVec ¶
func (n *Namespaced) GetTimerVec(path string, labelNames ...string) StatTimerVec
GetTimerVec returns an editable timer stat for a given path with labels, these labels must be consistent with any other metrics registered on the same path.
func (*Namespaced) HandlerFunc ¶
func (n *Namespaced) HandlerFunc() http.HandlerFunc
HandlerFunc returns the http handler of the child.
func (*Namespaced) WithLabels ¶
func (n *Namespaced) WithLabels(labels ...string) *Namespaced
WithLabels returns a namespaced metrics exporter with a new set of labels, which are added to any prior labels.
func (*Namespaced) WithMapping ¶
func (n *Namespaced) WithMapping(m *Mapping) *Namespaced
WithMapping returns a namespaced metrics exporter with a new mapping. Mappings are applied _before_ the prefix and static labels are applied. Mappings already added are executed after this new mapping.
func (*Namespaced) WithStats ¶
func (n *Namespaced) WithStats(s Type) *Namespaced
WithStats returns a namespaced metrics exporter with a different stats implementation.
type StatCounter ¶
type StatCounter interface { // Incr increments a counter by an integer amount. Incr(count int64) // IncrFloat64 increments a counter by a decimal amount. IncrFloat64(count float64) }
StatCounter is a representation of a single counter metric stat. Interactions with this stat are thread safe.
type StatCounterVec ¶
type StatCounterVec interface { // With returns a StatCounter with a set of label values. With(labelValues ...string) StatCounter }
StatCounterVec creates StatCounters with dynamic labels.
func FakeCounterVec ¶
func FakeCounterVec(f func(...string) StatCounter) StatCounterVec
FakeCounterVec returns a counter vec implementation that ignores labels.
type StatGauge ¶
type StatGauge interface { // Set sets the integer value of a gauge metric. Set(value int64) // Incr increments with an integer value a gauge by an amount. Incr(count int64) // Decr decrements a gauge by an integer amount. Decr(count int64) // SetFloat64 sets the value of a gauge metric. SetFloat64(value float64) // IncrFloat64 increments a gauge by an amount. IncrFloat64(count float64) // DecrFloat64 decrements a gauge by an amount. DecrFloat64(count float64) }
StatGauge is a representation of a single gauge metric stat. Interactions with this stat are thread safe.
type StatGaugeVec ¶
type StatGaugeVec interface { // With returns a StatGauge with a set of label values. With(labelValues ...string) StatGauge }
StatGaugeVec creates StatGauges with dynamic labels.
func FakeGaugeVec ¶
func FakeGaugeVec(f func(...string) StatGauge) StatGaugeVec
FakeGaugeVec returns a gauge vec implementation that ignores labels.
type StatTimer ¶
type StatTimer interface { // Timing sets a timing metric. Timing(delta int64) }
StatTimer is a representation of a single timer metric stat, timing values should be presented in nanoseconds for consistency. Interactions with this stat are thread safe.
type StatTimerVec ¶
type StatTimerVec interface { // With returns a StatTimer with a set of label values. With(labelValues ...string) StatTimer }
StatTimerVec creates StatTimers with dynamic labels.
func FakeTimerVec ¶
func FakeTimerVec(f func(...string) StatTimer) StatTimerVec
FakeTimerVec returns a timer vec implementation that ignores labels.
type Type ¶
type Type interface { // GetCounter returns an editable counter stat for a given path. GetCounter(path string) StatCounter // GetCounterVec returns an editable counter stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetCounterVec(path string, labelNames ...string) StatCounterVec // GetTimer returns an editable timer stat for a given path. GetTimer(path string) StatTimer // GetTimerVec returns an editable timer stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetTimerVec(path string, labelNames ...string) StatTimerVec // GetGauge returns an editable gauge stat for a given path. GetGauge(path string) StatGauge // GetGaugeVec returns an editable gauge stat for a given path with labels, // these labels must be consistent with any other metrics registered on the // same path. GetGaugeVec(path string, labelNames ...string) StatGaugeVec // HandlerFunc returns an optional HTTP request handler that exposes metrics // from the implementation. If nil is returned then no endpoint will be // registered. HandlerFunc() http.HandlerFunc // Close stops aggregating stats and cleans up resources. Close() error }
Type is an interface for metrics aggregation.