forked from TrueCloudLab/frostfs-node
[#1054] neofs-node: add epoch metric
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e1137aa09f
commit
e96eb3e00b
3 changed files with 24 additions and 0 deletions
|
@ -1,10 +1,13 @@
|
|||
package metrics
|
||||
|
||||
import "github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
const namespace = "neofs_node"
|
||||
|
||||
type StorageMetrics struct {
|
||||
objectServiceMetrics
|
||||
engineMetrics
|
||||
epoch prometheus.Gauge
|
||||
}
|
||||
|
||||
func NewStorageMetrics() *StorageMetrics {
|
||||
|
@ -14,8 +17,22 @@ func NewStorageMetrics() *StorageMetrics {
|
|||
engine := newEngineMetrics()
|
||||
engine.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 &StorageMetrics{
|
||||
objectServiceMetrics: objectService,
|
||||
engineMetrics: engine,
|
||||
epoch: epoch,
|
||||
}
|
||||
}
|
||||
|
||||
// SetEpoch updates epoch metric.
|
||||
func (m *StorageMetrics) SetEpoch(epoch uint64) {
|
||||
m.epoch.Set(float64(epoch))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue