Skip to content

Commit 7a4b529

Browse files
authored
Avoid copying the histogram metric buckets. (#331)
1 parent 3ec526a commit 7a4b529

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/include/prometheus/histogram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Histogram {
5757
/// Increments counters given a count for each bucket. (i.e. the caller of
5858
/// this function must have already sorted the values into buckets).
5959
/// Also increments the total sum of all observations by the given value.
60-
void ObserveMultiple(const std::vector<double> bucket_increments,
60+
void ObserveMultiple(const std::vector<double>& bucket_increments,
6161
const double sum_of_values);
6262

6363
/// \brief Get the current value of the counter.

core/src/histogram.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void Histogram::Observe(const double value) {
2424
bucket_counts_[bucket_index].Increment();
2525
}
2626

27-
void Histogram::ObserveMultiple(const std::vector<double> bucket_increments,
27+
void Histogram::ObserveMultiple(const std::vector<double>& bucket_increments,
2828
const double sum_of_values) {
2929
if (bucket_increments.size() != bucket_counts_.size()) {
3030
throw std::length_error(

0 commit comments

Comments
 (0)