Fix vector count in metrics showing minus zero (#7678)

Co-authored-by: <jojii <jojii@gmx.net>
This commit is contained in:
Tim Visée
2025-12-03 10:26:28 +01:00
committed by timvisee
co-authored by <jojii
parent 10cf439411
commit 6b86896751
+4 -1
View File
@@ -349,7 +349,10 @@ impl MetricsProvider for CollectionsTelemetry {
let vector_count = vector_count_by_name
.iter()
.map(|m| m.get_gauge().get_value())
.sum();
.sum::<f64>()
// The sum of an empty f64 iterator returns `-0`. Since a negative
// number of vectors is impossible, taking the absolute value is always safe.
.abs();
metrics.push_metric(metric_family(
"collections_vector_total",