File tree Expand file tree Collapse file tree 2 files changed +15
-17
lines changed Expand file tree Collapse file tree 2 files changed +15
-17
lines changed Original file line number Diff line number Diff line change 1
1
package keypermetrics
2
2
3
3
import (
4
- "time"
5
-
6
4
"github.com/prometheus/client_golang/prometheus"
7
5
)
8
6
9
- var startTime = time .Now ()
10
-
11
- var metricsKeyperUptime = prometheus .NewGaugeFunc (
12
- prometheus.GaugeOpts {
13
- Namespace : "shutter" ,
14
- Subsystem : "keyper" ,
15
- Name : "uptime_seconds" ,
16
- Help : "Number of seconds the Keyper has been running" ,
17
- },
18
- func () float64 {
19
- return float64 (time .Since (startTime ).Milliseconds ()) / 1000
20
- },
21
- )
22
-
23
7
var MetricsKeyperCurrentBlockL1 = prometheus .NewGauge (
24
8
prometheus.GaugeOpts {
25
9
Namespace : "shutter" ,
@@ -96,7 +80,6 @@ var MetricsKeyperBatchConfigInfo = prometheus.NewGaugeVec(
96
80
[]string {"batch_config_index" , "keyper_addresses" })
97
81
98
82
func InitMetrics () {
99
- prometheus .MustRegister (metricsKeyperUptime )
100
83
prometheus .MustRegister (MetricsKeyperCurrentBlockL1 )
101
84
prometheus .MustRegister (MetricsKeyperCurrentBlockShuttermint )
102
85
prometheus .MustRegister (MetricsKeyperCurrentEon )
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ import (
14
14
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/service"
15
15
)
16
16
17
+ var startTime = time .Now ()
18
+
17
19
var metricsGoBuildInfo = prometheus .NewGauge (
18
20
prometheus.GaugeOpts {
19
21
Namespace : "go" ,
@@ -26,9 +28,22 @@ var metricsGoBuildInfo = prometheus.NewGauge(
26
28
},
27
29
)
28
30
31
+ var metricsUptime = prometheus .NewGaugeFunc (
32
+ prometheus.GaugeOpts {
33
+ Namespace : "" ,
34
+ Subsystem : "" ,
35
+ Name : "uptime_seconds" ,
36
+ Help : "Number of seconds the Node has been running" ,
37
+ },
38
+ func () float64 {
39
+ return float64 (time .Since (startTime ).Milliseconds ()) / 1000
40
+ },
41
+ )
42
+
29
43
func init () {
30
44
metricsGoBuildInfo .Set (1 )
31
45
prometheus .MustRegister (metricsGoBuildInfo )
46
+ prometheus .MustRegister (metricsUptime )
32
47
}
33
48
34
49
type MetricsServer struct {
You can’t perform that action at this time.
0 commit comments