28 lines
556 B
Go
28 lines
556 B
Go
package metrics
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
const stateSubsystem = "state"
|
|
|
|
type stateMetrics struct {
|
|
healthCheck metric[prometheus.Gauge]
|
|
}
|
|
|
|
func newStateMetrics() stateMetrics {
|
|
return stateMetrics{
|
|
healthCheck: newGauge(prometheus.GaugeOpts{
|
|
Namespace: namespace,
|
|
Subsystem: stateSubsystem,
|
|
Name: "health",
|
|
Help: "Current Node state",
|
|
}),
|
|
}
|
|
}
|
|
|
|
func (m stateMetrics) register() {
|
|
mustRegister(m.healthCheck)
|
|
}
|
|
|
|
func (m stateMetrics) SetHealth(s int32) {
|
|
m.healthCheck.value.Set(float64(s))
|
|
}
|