-
Notifications
You must be signed in to change notification settings - Fork 4
/
gauge_aggregative_flow.go
69 lines (60 loc) · 2.91 KB
/
gauge_aggregative_flow.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
62
63
64
65
66
67
68
69
package metrics
// MetricGaugeAggregativeFlow is an aggregative/summarizive metric (like "average", "percentile 99" and so on)..
// It's an analog of prometheus' "Summary" (see https://prometheus.io/docs/concepts/metric_types/#summary).
//
// MetricGaugeAggregativeFlow uses the "Flow" method to aggregate the statistics (see "Flow" in README.md)
type MetricGaugeAggregativeFlow struct {
commonAggregativeFlow
}
func (r *Registry) newMetricGaugeAggregativeFlow(key string, tags AnyTags) *MetricGaugeAggregativeFlow {
metric := metricGaugeAggregativeFlowPool.Get().(*MetricGaugeAggregativeFlow)
metric.init(r, key, tags)
return metric
}
func (m *MetricGaugeAggregativeFlow) init(r *Registry, key string, tags AnyTags) {
m.commonAggregativeFlow.init(r, m, key, tags)
}
// GaugeAggregativeFlow returns a metric of type "MetricGaugeAggregativeFlow".
//
// For the same key and tags it will return the same metric.
//
// If there's no such metric then it will create it, register it in the registry and return it.
// If there's already such metric then it will just return the metric.
//
// MetricGaugeAggregativeFlow is an aggregative/summarizive metric (like "average", "percentile 99" and so on)..
// It's an analog of prometheus' "Summary" (see https://prometheus.io/docs/concepts/metric_types/#summary).
//
// MetricGaugeAggregativeFlow uses the "Flow" method to aggregate the statistics (see "Flow" in README.md)
func GaugeAggregativeFlow(key string, tags AnyTags) *MetricGaugeAggregativeFlow {
return registry.GaugeAggregativeFlow(key, tags)
}
// GaugeAggregativeFlow returns a metric of type "MetricGaugeAggregativeFlow".
//
// For the same key and tags it will return the same metric.
//
// If there's no such metric then it will create it, register it in the registry and return it.
// If there's already such metric then it will just return the metric.
//
// MetricGaugeAggregativeFlow is an aggregative/summarizive metric (like "average", "percentile 99" and so on)..
// It's an analog of prometheus' "Summary" (see https://prometheus.io/docs/concepts/metric_types/#summary).
//
// MetricGaugeAggregativeFlow uses the "Flow" method to aggregate the statistics (see "Flow" in README.md)
func (r *Registry) GaugeAggregativeFlow(key string, tags AnyTags) *MetricGaugeAggregativeFlow {
if IsDisabled() {
return (*MetricGaugeAggregativeFlow)(nil)
}
m := r.Get(TypeGaugeAggregativeFlow, key, tags)
if m != nil {
return m.(*MetricGaugeAggregativeFlow)
}
return r.newMetricGaugeAggregativeFlow(key, tags)
}
// ConsiderValue adds a value to the statistics, it's an analog of prometheus' "Observe"
// (see https://godoc.org/github.com/prometheus/client_golang/prometheus#Summary)
func (m *MetricGaugeAggregativeFlow) ConsiderValue(v float64) {
m.considerValue(v)
}
// GetType always returns TypeGaugeAggregativeFlow (because of object type "MetricGaugeAggregativeFlow")
func (m *MetricGaugeAggregativeFlow) GetType() Type {
return TypeGaugeAggregativeFlow
}