forked from grafana/tempo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.go
More file actions
71 lines (58 loc) · 1.9 KB
/
interface.go
File metadata and controls
71 lines (58 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package registry
import (
"github.com/prometheus/prometheus/model/labels"
)
// Registry is a metrics store.
type Registry interface {
NewLabelBuilder() LabelBuilder
// NewInfoMetricLabelBuilder returns a LabelBuilder that skips the per-label
// cardinality limiter and drain sanitizer.
// Use this builder for info metrics (target_info, host_info) whose labels are high cardinality by design.
NewInfoMetricLabelBuilder() LabelBuilder
NewCounter(name string) Counter
NewHistogram(name string, buckets []float64, histogramOverride HistogramMode) Histogram
NewGauge(name string) Gauge
}
type LabelBuilder interface {
Add(name, value string)
CloseAndBuildLabels() (labels.Labels, bool)
}
// Counter
// https://prometheus.io/docs/concepts/metric_types/#counter
type Counter interface {
metric
Inc(lbls labels.Labels, value float64)
}
// Histogram
// https://prometheus.io/docs/concepts/metric_types/#histogram
type Histogram interface {
metric
// ObserveWithExemplar observes a datapoint with the given values. traceID will be added as exemplar.
ObserveWithExemplar(lbls labels.Labels, value float64, traceID string, multiplier float64)
}
// Gauge
// https://prometheus.io/docs/concepts/metric_types/#gauge
// https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#Gauge
type Gauge interface {
metric
// Set sets the Gauge to an arbitrary value.
Set(lbls labels.Labels, value float64)
Inc(lbls labels.Labels, value float64)
SetForTargetInfo(lbls labels.Labels, value float64)
}
type HistogramMode int
const (
HistogramModeClassic HistogramMode = iota
HistogramModeNative
HistogramModeBoth
)
var HistogramModeToString = map[HistogramMode]string{
HistogramModeClassic: "classic",
HistogramModeNative: "native",
HistogramModeBoth: "both",
}
var HistogramModeToValue = map[string]HistogramMode{
"classic": HistogramModeClassic,
"native": HistogramModeNative,
"both": HistogramModeBoth,
}