qos: Do not export zero metrics counters #1690

Merged
dstepanov-yadro merged 1 commit from dstepanov-yadro/frostfs-node:fix/qos_unknown_metric into master 2025-03-20 12:28:38 +00:00

View file

@ -211,13 +211,26 @@ func (n *mClockLimiter) startMetricsCollect() {
continue
}
metrics := n.metrics.Load().metrics
for tag, s := range n.readStats {
metrics.SetOperationTagCounters(shardID, "read", tag, s.pending.Load(), s.inProgress.Load(), s.completed.Load(), s.resourceExhausted.Load())
}
for tag, s := range n.writeStats {
metrics.SetOperationTagCounters(shardID, "write", tag, s.pending.Load(), s.inProgress.Load(), s.completed.Load(), s.resourceExhausted.Load())
}
exportMetrics(metrics, n.readStats, shardID, "read")
exportMetrics(metrics, n.writeStats, shardID, "write")
}
}
}()
}
func exportMetrics(metrics Metrics, stats map[string]*stat, shardID, operation string) {
var pending uint64
var inProgress uint64
var completed uint64
var resExh uint64
for tag, s := range stats {
pending = s.pending.Load()
inProgress = s.inProgress.Load()
completed = s.completed.Load()
resExh = s.resourceExhausted.Load()
if pending == 0 && inProgress == 0 && completed == 0 && resExh == 0 {
Review

These counters only increase, so we don't need to consider case of removing metric on 1 -> 0 transition, right?

These counters only increase, so we don't need to consider case of removing metric on `1 -> 0` transition, right?
Review

right

right
continue
}
metrics.SetOperationTagCounters(shardID, operation, tag, pending, inProgress, completed, resExh)
}
}