-
Notifications
You must be signed in to change notification settings - Fork 3
/
meter.go
46 lines (35 loc) · 1.38 KB
/
meter.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
package metrics
import (
"github.com/alexfalkowski/go-service/runtime"
"go.opentelemetry.io/otel/metric"
)
// MustInt64ObservableCounter for metrics.
func MustInt64ObservableCounter(meter metric.Meter, name, description string) metric.Int64ObservableCounter {
c, err := meter.Int64ObservableCounter(name, metric.WithDescription(description))
runtime.Must(err)
return c
}
// MustFloat64ObservableCounter for metrics.
func MustFloat64ObservableCounter(meter metric.Meter, name, description string) metric.Float64ObservableCounter {
c, err := meter.Float64ObservableCounter(name, metric.WithDescription(description))
runtime.Must(err)
return c
}
// MustInt64Counter for metrics.
func MustInt64Counter(meter metric.Meter, name, description string) metric.Int64Counter {
c, err := meter.Int64Counter(name, metric.WithDescription(description))
runtime.Must(err)
return c
}
// MustFloat64Histogram for metrics.
func MustFloat64Histogram(meter metric.Meter, name, description string) metric.Float64Histogram {
h, err := meter.Float64Histogram(name, metric.WithDescription(description), metric.WithUnit("s"))
runtime.Must(err)
return h
}
// MustFloat64Histogram for metrics.
func MustInt64ObservableGauge(meter metric.Meter, name, description string) metric.Int64ObservableGauge {
g, err := meter.Int64ObservableGauge(name, metric.WithDescription(description))
runtime.Must(err)
return g
}