2022-07-19 15:16:42 +00:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
|
|
|
|
const stateSubsystem = "state"
|
|
|
|
|
|
|
|
type stateMetrics struct {
|
2023-04-05 10:39:02 +00:00
|
|
|
healthCheck metric[prometheus.Gauge]
|
2022-07-19 15:16:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func newStateMetrics() stateMetrics {
|
|
|
|
return stateMetrics{
|
2023-04-05 10:39:02 +00:00
|
|
|
healthCheck: newGauge(prometheus.GaugeOpts{
|
2022-07-19 15:16:42 +00:00
|
|
|
Namespace: namespace,
|
|
|
|
Subsystem: stateSubsystem,
|
|
|
|
Name: "health",
|
|
|
|
Help: "Current Node state",
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m stateMetrics) register() {
|
2023-04-05 08:44:13 +00:00
|
|
|
mustRegister(m.healthCheck)
|
2022-07-19 15:16:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m stateMetrics) SetHealth(s int32) {
|
2023-04-05 10:39:02 +00:00
|
|
|
m.healthCheck.value.Set(float64(s))
|
2022-07-19 15:16:42 +00:00
|
|
|
}
|