Dmitrii Stepanov
c348ae35b0
It was not obvious where metrics are used. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
31 lines
607 B
Go
31 lines
607 B
Go
package metrics
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/metrics"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
const stateSubsystem = "state"
|
|
|
|
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))
|
|
}
|