Skip to content

Commit

Permalink
Added Node name to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
first-sportsbook committed Dec 15, 2022
1 parent 0169f77 commit 908210e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,27 @@ import (
"k8s.io/client-go/tools/clientcmd"
)

var f config.StartupFlags
var (
prometheusNamespace = "multicooker"
pressureThresholdExceeded = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: prometheusNamespace,
Name: "pressure_threshold_exceeded",
Name: fmt.Sprintf("pressure_threshold_exceeded_%s", f.NodeName),
Help: "cpu pressure is currently above (1) or below (0) threshold",
})
pressureThresholdExceededTotal = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: prometheusNamespace,
Name: "pressure_threshold_exceeded_total",
Name: fmt.Sprintf("pressure_threshold_exceeded_total_%s", f.NodeName),
Help: "number of times the pressure threshold was exceeded",
})
pressureRecoveredTotal = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: prometheusNamespace,
Name: "pressure_recovered_total",
Name: fmt.Sprintf("pressure_recovered_total_%s", f.NodeName),
Help: "number of times the pressure on the node recovered",
})
pressureEnabled = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: prometheusNamespace,
Name: "enabled",
Name: fmt.Sprintf("enabled_%s", f.NodeName),
Help: "multicooker is enabled (1) or disabled (0)",
})
)
Expand All @@ -49,8 +50,6 @@ func main() {
prometheus.MustRegister(pressureRecoveredTotal)
prometheus.MustRegister(pressureEnabled)

var f config.StartupFlags

flag.StringVar(&f.KubeConfig, "kubeconfig", "", "file path to kubeconfig")
flag.Float64Var(&f.TaintThreshold, "taint-threshold", 25, "pressure threshold value")
flag.Float64Var(&f.EvictThreshold, "evict-threshold", 50, "pressure threshold value")
Expand Down

0 comments on commit 908210e

Please sign in to comment.