-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
57 lines (53 loc) · 1.47 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
// Package metrics implements all monitoring-related Prometheus metrics
// for this repo.
package metrics
import (
"log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
// Metrics for monitoring with Prometheus.
var (
GatherRuns = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gather_run_total",
Help: "The number of times each gather command has been run",
},
[]string{"datatype"},
)
GatherErrors = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gather_error_total",
Help: "The number of times each gather command has had an error",
},
[]string{"datatype"},
)
GatherRuntime = promauto.NewHistogramVec(
prometheus.HistogramOpts{
Name: "gather_command_runtime_seconds",
Help: "How long each command took to run in seconds",
},
[]string{"datatype"},
)
ConfigLoadTime = promauto.NewGauge(
prometheus.GaugeOpts{
Name: "config_load_timestamp",
Help: "The timestamp of the time the config was loaded from disk",
},
)
ConfigLoadCount = promauto.NewCounter(
prometheus.CounterOpts{
Name: "config_loads_total",
Help: "The number of times the config has been reloaded",
},
)
ConfigLoadFailures = promauto.NewCounter(
prometheus.CounterOpts{
Name: "config_load_failures_total",
Help: "The number of times the config has not been reloaded, even after reload was requested",
},
)
)
func init() {
log.Println("Nodeinfo metrics have been initialized")
}