-
Notifications
You must be signed in to change notification settings - Fork 211
/
metrics.go
55 lines (46 loc) · 1.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
52
53
54
55
package hare
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spacemeshos/go-spacemesh/metrics"
)
const (
namespace = "hare"
// labels for hare consensus output.
success = "ok"
failure = "fail"
)
var (
preNumProposals = metrics.NewCounter(
"in_proposals",
namespace,
"number of proposals for as consensus input",
[]string{},
).WithLabelValues()
postNumProposals = metrics.NewCounter(
"out_proposals",
namespace,
"number of proposals for as consensus output",
[]string{},
).WithLabelValues()
consensusCount = metrics.NewCounter(
"consensus",
namespace,
"number of hare consensus",
[]string{"outcome"},
)
consensusOkCnt = consensusCount.WithLabelValues(success)
consensusFailCnt = consensusCount.WithLabelValues(failure)
numIterations = metrics.NewHistogramWithBuckets(
"num_iterations",
namespace,
"number of iterations for hare to terminate",
[]string{},
prometheus.ExponentialBuckets(4, 2, 3),
).WithLabelValues()
processesGauge = metrics.NewGauge(
"processes",
namespace,
"number of hare processes",
[]string{},
).WithLabelValues()
)