-
Notifications
You must be signed in to change notification settings - Fork 211
/
metrics.go
51 lines (42 loc) · 1 KB
/
metrics.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
package bootstrap
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spacemeshos/go-spacemesh/metrics"
)
const (
namespace = "bootstrap"
success = "ok"
failure = "fail"
labelQuery = "query"
)
var (
queryCount = metrics.NewCounter(
"query",
namespace,
"number of queries made to the update site",
[]string{"outcome"},
)
queryOkCount = queryCount.WithLabelValues(success)
queryFailureCount = queryCount.WithLabelValues(failure)
received = metrics.NewCounter(
"received",
namespace,
"total bytes received",
nil,
).WithLabelValues()
updateCount = metrics.NewCounter(
"updates",
namespace,
"number of updates received",
[]string{"outcome"},
)
updateOkCount = updateCount.WithLabelValues(success)
updateFailureCount = updateCount.WithLabelValues(failure)
queryDuration = metrics.NewHistogramWithBuckets(
"query_duration",
namespace,
"duration in ns for querying update",
[]string{"step"},
prometheus.ExponentialBuckets(1_000_000, 4, 10),
)
)