-
Notifications
You must be signed in to change notification settings - Fork 211
/
metrics.go
67 lines (59 loc) · 1.94 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package hare3
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spacemeshos/go-spacemesh/metrics"
)
const namespace = "hare"
var (
processCounter = metrics.NewCounter(
"session",
namespace,
"number of hare sessions at different stages",
[]string{"stage"},
)
sessionStart = processCounter.WithLabelValues("started")
sessionTerminated = processCounter.WithLabelValues("terminated")
sessionCoin = processCounter.WithLabelValues("weakcoin")
sessionResult = processCounter.WithLabelValues("result")
exitErrors = metrics.NewCounter(
"exit_errors",
namespace,
"number of unexpected exit errors. should remain at zero",
[]string{},
).WithLabelValues()
validationError = metrics.NewCounter(
"validation_errors",
namespace,
"number of validation errors. not expected to be at zero",
[]string{"error"},
)
notRegisteredError = validationError.WithLabelValues("not_registered")
malformedError = validationError.WithLabelValues("malformed")
signatureError = validationError.WithLabelValues("signature")
oracleError = validationError.WithLabelValues("oracle")
maliciousError = validationError.WithLabelValues("malicious")
droppedMessages = metrics.NewCounter(
"dropped_msgs",
namespace,
"number of messages dropped by gossip",
[]string{},
).WithLabelValues()
validationLatency = metrics.NewHistogramWithBuckets(
"validation_seconds",
namespace,
"validation time in seconds",
[]string{"step"},
prometheus.ExponentialBuckets(0.01, 2, 10),
)
oracleLatency = validationLatency.WithLabelValues("oracle")
submitLatency = validationLatency.WithLabelValues("submit")
protocolLatency = metrics.NewHistogramWithBuckets(
"protocol_seconds",
namespace,
"protocol time in seconds",
[]string{"step"},
prometheus.ExponentialBuckets(0.01, 2, 10),
)
proposalsLatency = protocolLatency.WithLabelValues("proposals")
activeLatency = protocolLatency.WithLabelValues("active")
)