File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,6 @@ io::prometheus::client::Metric Histogram::Collect() {
26
26
auto metric = io::prometheus::client::Metric{};
27
27
auto histogram = metric.mutable_histogram ();
28
28
29
- auto sample_count = std::accumulate (
30
- bucket_counts_.begin (), bucket_counts_.end (), double {0 },
31
- [](double sum, const Counter& counter) { return sum + counter.Value (); });
32
- histogram->set_sample_count (sample_count);
33
- histogram->set_sample_sum (sum_.Value ());
34
-
35
29
auto cumulative_count = 0ULL ;
36
30
for (std::size_t i = 0 ; i < bucket_counts_.size (); i++) {
37
31
cumulative_count += bucket_counts_[i].Value ();
@@ -41,7 +35,9 @@ io::prometheus::client::Metric Histogram::Collect() {
41
35
? std::numeric_limits<double >::infinity ()
42
36
: bucket_boundaries_[i]);
43
37
}
38
+ histogram->set_sample_count (cumulative_count);
39
+ histogram->set_sample_sum (sum_.Value ());
40
+
44
41
return metric;
45
42
}
46
43
}
47
-
You can’t perform that action at this time.
0 commit comments