frostfs-node/pkg/metrics/state.go

29 lines
556 B
Go
Raw Permalink Normal View History

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))
}