mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-11-25 16:51:00 +00:00
d55b42eabb
Signed-off-by: Frank Davidson <frank_davidson@manulife.com> Signed-off-by: Frank Davidson <ffdavidson@gmail.com>
42 lines
836 B
Go
42 lines
836 B
Go
package metrics
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
type metricType int
|
|
|
|
const (
|
|
CounterMetricType metricType = iota
|
|
GaugeMetricType
|
|
SummaryMetricType
|
|
HistogramMetricType
|
|
)
|
|
|
|
type nameHash uint64
|
|
type valueHash uint64
|
|
type labelHash struct {
|
|
// This is a hash over the label names
|
|
names nameHash
|
|
// This is a hash over the label names + label values
|
|
values valueHash
|
|
}
|
|
|
|
type metricHolder interface{}
|
|
|
|
type vectorHolder interface {
|
|
Delete(label prometheus.Labels) bool
|
|
}
|
|
|
|
type vector struct {
|
|
holder vectorHolder
|
|
refCount uint64
|
|
}
|
|
|
|
type metric struct {
|
|
metricType metricType
|
|
// Vectors key is the hash of the label names
|
|
vectors map[nameHash]*vector
|
|
// Metrics key is a hash of the label names + label values
|
|
metrics map[valueHash]*registeredMetric
|
|
}
|