#include <userver/utils/statistics/metric_value.hpp>
The value of a metric.
Cheap to copy, expected to be passed around by value.
Definition at line 20 of file metric_value.hpp.
Public Types | |
using | RawType = std::variant<std::int64_t, double, Rate, HistogramView> |
Public Member Functions | |
MetricValue (const MetricValue &)=default | |
MetricValue & | operator= (const MetricValue &)=default |
bool | operator== (const MetricValue &other) const noexcept |
bool | operator!= (const MetricValue &other) const noexcept |
std::int64_t | AsInt () const |
Retrieve the value of an integer metric. | |
double | AsFloat () const |
Retrieve the value of a floating-point metric. | |
Rate | AsRate () const |
Retrieve the value of a Rate metric. | |
bool | IsRate () const noexcept |
Returns whether metric is Rate metric. | |
HistogramView | AsHistogram () const |
Retrieve the value of a HistogramView metric. | |
bool | IsHistogram () const noexcept |
Returns whether metric is HistogramView metric. | |
template<typename VisitorFunc > | |
decltype(auto) | Visit (VisitorFunc visitor) const |
Calls visitor with either a std::int64_t or a double value. | |
using utils::statistics::MetricValue::RawType = std::variant<std::int64_t, double, Rate, HistogramView> |
Definition at line 22 of file metric_value.hpp.
|
inline |
Retrieve the value of a floating-point metric.
std::exception | on type mismatch. |
Definition at line 42 of file metric_value.hpp.
|
inline |
Retrieve the value of a HistogramView metric.
std::exception | on type mismatch. |
Definition at line 53 of file metric_value.hpp.
|
inline |
Retrieve the value of an integer metric.
std::exception | on type mismatch. |
Definition at line 38 of file metric_value.hpp.
|
inline |
Retrieve the value of a Rate metric.
std::exception | on type mismatch. |
Definition at line 46 of file metric_value.hpp.
|
inlinenoexcept |
Returns whether metric is HistogramView metric.
Definition at line 56 of file metric_value.hpp.
|
inlinenoexcept |
Returns whether metric is Rate metric.
Definition at line 49 of file metric_value.hpp.
|
inlinenoexcept |
Definition at line 32 of file metric_value.hpp.
|
inlinenoexcept |
Definition at line 28 of file metric_value.hpp.
|
inline |
Calls visitor
with either a std::int64_t
or a double
value.
visitor
returns. Definition at line 63 of file metric_value.hpp.