-
Notifications
You must be signed in to change notification settings - Fork 17
/
metrics_client.go
61 lines (48 loc) · 2.46 KB
/
metrics_client.go
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
package baker
import (
"time"
)
// A MetricsClient allows to instrument components code and communicate the
// metrics to the metrics backend that is configured in Baker.
//
// New metrics backends must implement this interface and register their
// description as a MetricDesc in Components.Metrics. See ./examples/metrics.
type MetricsClient interface {
// Gauge sets the value of a metric of type gauge. A Gauge represents a
// single numerical data point that can arbitrarily go up and down.
Gauge(name string, value float64)
// GaugeWithTags sets the value of a metric of type gauge and associates
// that value with a set of tags.
GaugeWithTags(name string, value float64, tags []string)
// RawCount sets the value of a metric of type counter. A counter is a
// cumulative metrics that can only increase. RawCount sets the current
// value of the counter.
RawCount(name string, value int64)
// RawCountWithTags sets the value of a metric or type counter and associates
// that value with a set of tags.
RawCountWithTags(name string, value int64, tags []string)
// DeltaCount increments the value of a metric of type counter by delta.
// delta must be positive.
DeltaCount(name string, delta int64)
// DeltaCountWithTags increments the value of a metric or type counter and
// associates that value with a set of tags.
DeltaCountWithTags(name string, delta int64, tags []string)
// Histogram adds a sample to a metric of type histogram. A histogram
// samples observations and counts them in different 'buckets' in order
// to track and show the statistical distribution of a set of values.
Histogram(name string, value float64)
// HistogramWithTags adds a sample to an histogram and associates that
// sample with a set of tags.
HistogramWithTags(name string, value float64, tags []string)
// Duration adds a duration to a metric of type histogram. A histogram
// samples observations and counts them in different 'buckets'. Duration
// is basically an histogram but allows to sample values of type time.Duration.
Duration(name string, value time.Duration)
// DurationWithTags adds a duration to an histogram and associates that
// duration with a set of tags.
DurationWithTags(name string, value time.Duration, tags []string)
// Close releases resources allocated by the metrics client such as
// connections or files and flushes potentially buffered data that has not
// been processed yet. Once closed the MetricsClient shoudld not be reused.
Close() error
}