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 }