-
Notifications
You must be signed in to change notification settings - Fork 80
/
prometheus.go
60 lines (51 loc) · 1.33 KB
/
prometheus.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
package logging
import (
"github.com/prometheus/client_golang/prometheus"
)
// StartHeight represents the Telemetry counter used to set the start height of the parsing
var StartHeight = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_initial_height",
Help: "Initial parsing height.",
},
)
// WorkerCount represents the Telemetry counter used to track the worker count
var WorkerCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_worker_count",
Help: "Number of active workers.",
},
)
// WorkerHeight represents the Telemetry counter used to track the last indexed height for each worker
var WorkerHeight = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "juno_last_indexed_height",
Help: "Height of the last indexed block.",
},
[]string{"worker_index"},
)
// ErrorCount represents the Telemetry counter used to track the number of errors emitted
var ErrorCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "juno_error_count",
Help: "Total number of errors emitted.",
},
)
func init() {
err := prometheus.Register(StartHeight)
if err != nil {
panic(err)
}
err = prometheus.Register(WorkerCount)
if err != nil {
panic(err)
}
err = prometheus.Register(WorkerHeight)
if err != nil {
panic(err)
}
err = prometheus.Register(ErrorCount)
if err != nil {
panic(err)
}
}