frostfs-node/pkg/metrics/state.go
Evgenii Stratonikov 6fef2726b8 [#164] metrics: Allow to export metrics description
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2023-04-24 09:01:13 +00:00

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