Skip to content

Commit

Permalink
Avoid copying the histogram metric buckets. (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgavedissian authored Jan 30, 2020
1 parent 3ec526a commit 7a4b529
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/include/prometheus/histogram.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Histogram {
/// Increments counters given a count for each bucket. (i.e. the caller of
/// this function must have already sorted the values into buckets).
/// Also increments the total sum of all observations by the given value.
void ObserveMultiple(const std::vector<double> bucket_increments,
void ObserveMultiple(const std::vector<double>& bucket_increments,
const double sum_of_values);

/// \brief Get the current value of the counter.
Expand Down
2 changes: 1 addition & 1 deletion core/src/histogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void Histogram::Observe(const double value) {
bucket_counts_[bucket_index].Increment();
}

void Histogram::ObserveMultiple(const std::vector<double> bucket_increments,
void Histogram::ObserveMultiple(const std::vector<double>& bucket_increments,
const double sum_of_values) {
if (bucket_increments.size() != bucket_counts_.size()) {
throw std::length_error(
Expand Down

0 comments on commit 7a4b529

Please sign in to comment.