frostfs-node/pkg/metrics/metrics.go
Pavel Karpy 581a9901c9 [] metrics: Add health metrics
Also, rename metrics structure since it collects not only storage metrics
now.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-07-21 16:07:47 +03:00

43 lines
914 B
Go

package metrics
import "github.com/prometheus/client_golang/prometheus"
const namespace = "neofs_node"
type NodeMetrics struct {
objectServiceMetrics
engineMetrics
stateMetrics
epoch prometheus.Gauge
}
func NewNodeMetrics() *NodeMetrics {
objectService := newObjectServiceMetrics()
objectService.register()
engine := newEngineMetrics()
engine.register()
state := newStateMetrics()
state.register()
epoch := prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: innerRingSubsystem,
Name: "epoch",
Help: "Current epoch as seen by inner-ring node.",
})
prometheus.MustRegister(epoch)
return &NodeMetrics{
objectServiceMetrics: objectService,
engineMetrics: engine,
stateMetrics: state,
epoch: epoch,
}
}
// SetEpoch updates epoch metric.
func (m *NodeMetrics) SetEpoch(epoch uint64) {
m.epoch.Set(float64(epoch))
}