frostfs-node/pkg/metrics/state.go
Dmitrii Stepanov 03aa210145 [] metrics: Move labels to consts
To unify label naming all lable keys and other consts are moved to
one file.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-06-21 15:13:26 +03:00

29 lines
575 B
Go

package metrics
import (
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
"github.com/prometheus/client_golang/prometheus"
)
type StateMetrics interface {
SetHealth(s int32)
}
type stateMetrics struct {
healthCheck prometheus.Gauge
}
func newStateMetrics() *stateMetrics {
return &stateMetrics{
healthCheck: metrics.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: stateSubsystem,
Name: "health",
Help: "Current Node state",
}),
}
}
func (m *stateMetrics) SetHealth(s int32) {
m.healthCheck.Set(float64(s))
}