-
Notifications
You must be signed in to change notification settings - Fork 1
/
metrics.go
41 lines (34 loc) · 978 Bytes
/
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
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
)
const (
MetricsLabel string = "node_name"
)
var drainCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "node_wizard_drain_count",
Help: "Number of times the drain function has been called",
},
[]string{MetricsLabel},
)
var uncordonCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "node_wizard_uncordon_count",
Help: "Number of times the uncordon function has been called",
},
[]string{MetricsLabel},
)
func init() {
prometheus.MustRegister(drainCounter)
prometheus.MustRegister(uncordonCounter)
}
func IncrementDrainCounter(nodeName string) {
log.Debugf("DrainCounter called for node: %s", nodeName)
drainCounter.WithLabelValues(nodeName).Inc()
}
func IncrementUncordonCounter(nodeName string) {
log.Debugf("UncordonCounter called for node: %s", nodeName)
uncordonCounter.WithLabelValues(nodeName).Inc()
}