-
Notifications
You must be signed in to change notification settings - Fork 56
/
metrics.go
66 lines (57 loc) · 1.71 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
package app
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
evmSynced = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "evm",
Name: "synced",
Help: "Constant gauge of 1 if attached the omni_evm is synced, 0 if syncing.",
})
evmHeight = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "evm",
Name: "height",
Help: "Latest block height of the attached omni_evm",
})
evmPeers = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "evm",
Name: "peers",
Help: "Number of execution P2P peers of the attached omni_evm",
})
cometSynced = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "comet",
Name: "synced",
Help: "Constant gauge of 1 if attached the cometBFT is synced, 0 if syncing.",
})
cometValidator = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "comet",
Name: "validator",
Help: "Constant gauge of 1 if local halo node is a cometBFT validator, 0 if not a validator.",
})
dbSize = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "db",
Name: "size_bytes",
Help: "Current size of the database directory in bytes.",
})
nodeReadiness = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "halo",
Subsystem: "health",
Name: "ready",
Help: "Constant gauge of 1 if local halo node is ready, 0 if not.",
})
)
// setConstantGauge sets the value of a gauge to 1 if b is true, 0 otherwise.
func setConstantGauge(gauge prometheus.Gauge, b bool) {
var val float64
if b {
val = 1
}
gauge.Set(val)
}