-
Notifications
You must be signed in to change notification settings - Fork 107
/
metrics.go
62 lines (52 loc) · 1.4 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
package committee
import (
"sync"
"github.com/prometheus/client_golang/prometheus"
)
var (
storageWorkerLastFullRound = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "oasis_worker_storage_full_round",
Help: "The last round that was fully synced and finalized.",
},
[]string{"runtime"},
)
storageWorkerLastSyncedRound = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "oasis_worker_storage_synced_round",
Help: "The last round that was synced but not yet finalized.",
},
[]string{"runtime"},
)
storageWorkerLastPendingRound = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "oasis_worker_storage_pending_round",
Help: "The last round that is in-flight for syncing.",
},
[]string{"runtime"},
)
storageWorkerRoundSyncLatency = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "oasis_worker_storage_round_sync_latency",
Help: "Storage round sync latency (seconds).",
},
[]string{"runtime"},
)
storageWorkerCollectors = []prometheus.Collector{
storageWorkerLastFullRound,
storageWorkerLastSyncedRound,
storageWorkerLastPendingRound,
storageWorkerRoundSyncLatency,
}
prometheusOnce sync.Once
)
func (n *Node) getMetricLabels() prometheus.Labels {
return prometheus.Labels{
"runtime": n.commonNode.Runtime.ID().String(),
}
}
func initMetrics() {
prometheusOnce.Do(func() {
prometheus.MustRegister(storageWorkerCollectors...)
})
}