frostfs-node/pkg/metrics/metrics.go
Dmitrii Stepanov 4fcc81c999 [#232] shard: Add PUT metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-04-10 15:43:25 +03:00

48 lines
1,008 B
Go

package metrics
import "github.com/prometheus/client_golang/prometheus"
const namespace = "frostfs_node"
type NodeMetrics struct {
objectServiceMetrics
engineMetrics
stateMetrics
shardMetrics
epoch prometheus.Gauge
}
func NewNodeMetrics() *NodeMetrics {
objectService := newObjectServiceMetrics()
objectService.register()
engine := newEngineMetrics()
engine.register()
state := newStateMetrics()
state.register()
shard := newShardMetrics()
shard.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,
shardMetrics: shard,
epoch: epoch,
}
}
// SetEpoch updates epoch metric.
func (m *NodeMetrics) SetEpoch(epoch uint64) {
m.epoch.Set(float64(epoch))
}