forked from celestiaorg/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
collector.go
55 lines (52 loc) · 1.37 KB
/
collector.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 main
import (
"github.com/prometheus/client_golang/prometheus"
)
//Define the metrics we wish to expose
var (
gasBaseFeeMetric = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_baseFee",
Help: "Gas base fee."},
[]string{"network", "layer"},
)
gasUsedMetric = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_gasUsed",
Help: "Gas Used."},
[]string{"network", "layer"},
)
gasPrice = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_gasPrice",
Help: "Gas price."},
[]string{"network", "layer"},
)
blockNumber = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_blocknumber",
Help: "Current block number."},
[]string{"network", "layer"},
)
healthySequencer = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "op_healthy_sequencer",
Help: "Is the sequencer healthy?"},
[]string{"network"},
)
opExporterVersion = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "op_exporter_version",
Help: "Verion of the op-exporter software"},
[]string{"version", "commit", "goVersion", "buildDate"},
)
)
func init() {
//Register metrics with prometheus
prometheus.MustRegister(gasPrice)
prometheus.MustRegister(blockNumber)
prometheus.MustRegister(healthySequencer)
prometheus.MustRegister(opExporterVersion)
prometheus.MustRegister(gasBaseFeeMetric)
prometheus.MustRegister(gasUsedMetric)
}