#include <userver/utils/statistics/histogram_aggregator.hpp>
Used to aggregate multiple utils::statistics::Histogram metrics.
Usage example:
Definition at line 22 of file histogram_aggregator.hpp.
Classes | |
| struct | CopyBounds |
| Empty tag. Selects the constructor that copies bucket borders from a utils::statistics::HistogramView. More... | |
Public Member Functions | |
| HistogramAggregator (utils::span< const double > upper_bounds) | |
| Sets upper bounds for each non-"infinite" bucket. The lowest bound is always 0. | |
| HistogramAggregator (CopyBounds, HistogramView view) | |
| Copies bucket borders from view. Bucket counts stay zero. | |
| HistogramAggregator (HistogramAggregator &&) noexcept | |
| Transfers ownership of the bucket buffer. | |
| HistogramAggregator & | operator= (HistogramAggregator &&) noexcept |
| void | Add (HistogramView other) |
| Add the other histogram to the current one. | |
| void | AccountAt (std::size_t bucket_index, std::uint64_t count=1) noexcept |
| Non-atomically increment the bucket corresponding to the given index. | |
| void | AccountInf (std::uint64_t count=1) noexcept |
| Non-atomically increment the "infinity" bucket. | |
| void | Reset () noexcept |
| Reset all buckets to zero. | |
| HistogramView | GetView () const &noexcept |
| Allows reading the histogram. | |
|
explicit |
Sets upper bounds for each non-"infinite" bucket. The lowest bound is always 0.
| upper_bounds | is copied inside and is not required to be kept alive after the constructor completes. |
| utils::statistics::HistogramAggregator::HistogramAggregator | ( | CopyBounds | , |
| HistogramView | view ) |
Copies bucket borders from view. Bucket counts stay zero.
Use utils::statistics::HistogramAggregator::Add to copy or merge values afterwards.
|
noexcept |
Transfers ownership of the bucket buffer.
utils::statistics::HistogramView instances already taken from other remain valid and refer to that buffer, now owned by this object.
| void utils::statistics::HistogramAggregator::Add | ( | HistogramView | other | ) |
Add the other histogram to the current one.
Bucket borders in this and other must be either identical, or bucket borders in this must be a strict subset of bucket borders in other.
Writes to *this are non-atomic.
|
noexcept |
Views already taken from the left-hand side become invalid: its previous buffer is destroyed.