-
Notifications
You must be signed in to change notification settings - Fork 82
/
keys.go
65 lines (56 loc) · 1.88 KB
/
keys.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
package otelogen
import (
"go.opentelemetry.io/otel/metric"
)
const (
ClientRequestCount = "ogen.client.request_count" // Outgoing request count total
ClientErrorsCount = "ogen.client.errors_count" // Outgoing errors total
ClientDuration = "ogen.client.duration" // Outgoing end to end duration, milliseconds
)
func ClientRequestCountCounter(meter metric.Meter) (metric.Int64Counter, error) {
return meter.Int64Counter(
ClientRequestCount,
metric.WithDescription("Outgoing request count total"),
metric.WithUnit("{count}"),
)
}
func ClientErrorsCountCounter(meter metric.Meter) (metric.Int64Counter, error) {
return meter.Int64Counter(
ClientErrorsCount,
metric.WithDescription("Outgoing errors total"),
metric.WithUnit("{count}"),
)
}
func ClientDurationHistogram(meter metric.Meter) (metric.Float64Histogram, error) {
return meter.Float64Histogram(
ClientDuration,
metric.WithDescription("Outgoing end to end duration"),
metric.WithUnit("ms"),
)
}
const (
ServerRequestCount = "ogen.server.request_count" // Incoming request count total
ServerErrorsCount = "ogen.server.errors_count" // Incoming errors total
ServerDuration = "ogen.server.duration" // Incoming end to end duration, milliseconds
)
func ServerRequestCountCounter(meter metric.Meter) (metric.Int64Counter, error) {
return meter.Int64Counter(
ServerRequestCount,
metric.WithDescription("Incoming request count total"),
metric.WithUnit("{count}"),
)
}
func ServerErrorsCountCounter(meter metric.Meter) (metric.Int64Counter, error) {
return meter.Int64Counter(
ServerErrorsCount,
metric.WithDescription("Incoming errors total"),
metric.WithUnit("{count}"),
)
}
func ServerDurationHistogram(meter metric.Meter) (metric.Float64Histogram, error) {
return meter.Float64Histogram(
ServerDuration,
metric.WithDescription("Incoming end to end duration"),
metric.WithUnit("ms"),
)
}