Commit 0da5f1ac authored by acud's avatar acud Committed by GitHub

feat(batchstore): add storage radius metric (#2163)

parent fab0679f
...@@ -14,6 +14,7 @@ type metrics struct { ...@@ -14,6 +14,7 @@ type metrics struct {
Inner prometheus.Gauge Inner prometheus.Gauge
Outer prometheus.Gauge Outer prometheus.Gauge
Radius prometheus.Gauge Radius prometheus.Gauge
StorageRadius prometheus.Gauge
} }
func newMetrics() metrics { func newMetrics() metrics {
...@@ -44,6 +45,12 @@ func newMetrics() metrics { ...@@ -44,6 +45,12 @@ func newMetrics() metrics {
Name: "radius", Name: "radius",
Help: "Radius of responsibility observed by the batchstore.", Help: "Radius of responsibility observed by the batchstore.",
}), }),
StorageRadius: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: m.Namespace,
Subsystem: subsystem,
Name: "storage_radius",
Help: "Radius of responsibility communicated to the localstore",
}),
} }
} }
......
...@@ -115,6 +115,7 @@ func (s *store) Unreserve(cb postage.UnreserveIteratorFn) error { ...@@ -115,6 +115,7 @@ func (s *store) Unreserve(cb postage.UnreserveIteratorFn) error {
if s.rs.StorageRadius+1 < v.Radius { if s.rs.StorageRadius+1 < v.Radius {
s.rs.StorageRadius = v.Radius - 1 s.rs.StorageRadius = v.Radius - 1
s.metrics.StorageRadius.Set(float64(s.rs.StorageRadius))
if err = s.store.Put(reserveStateKey, s.rs); err != nil { if err = s.store.Put(reserveStateKey, s.rs); err != nil {
return true, err return true, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment