#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 24 of file metric_value.hpp.
Public Types | |
| using | RawType = std::variant<std::int64_t, double, Rate, HistogramView> |
Public Member Functions | |
| constexpr | MetricValue () noexcept |
| Creates an unspecified metric value. | |
| MetricValue (const MetricValue &)=default | |
| MetricValue & | operator= (const MetricValue &)=default |
| 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. | |
| constexpr | MetricValue (std::int64_t value) noexcept |
| constexpr | MetricValue (double value) noexcept |
| constexpr | MetricValue (Rate value) noexcept |
| constexpr | MetricValue (HistogramView value) noexcept |
| using utils::statistics::MetricValue::RawType = std::variant<std::int64_t, double, Rate, HistogramView> |
Definition at line 26 of file metric_value.hpp.
|
inlineconstexprnoexcept |
Creates an unspecified metric value.
Definition at line 29 of file metric_value.hpp.
|
inlineconstexprnoexcept |
Constructs MetricValue for tests.
Definition at line 33 of file metric_value.hpp.
|
inlineconstexprnoexcept |
Definition at line 35 of file metric_value.hpp.
|
inlineconstexprnoexcept |
Definition at line 37 of file metric_value.hpp.
|
inlineconstexprnoexcept |
Definition at line 39 of file metric_value.hpp.
|
inline |
Retrieve the value of a floating-point metric.
| std::exception | on type mismatch. |
Definition at line 56 of file metric_value.hpp.
|
inline |
Retrieve the value of a HistogramView metric.
| std::exception | on type mismatch. |
Definition at line 67 of file metric_value.hpp.
|
inline |
Retrieve the value of an integer metric.
| std::exception | on type mismatch. |
Definition at line 52 of file metric_value.hpp.
|
inline |
Retrieve the value of a Rate metric.
| std::exception | on type mismatch. |
Definition at line 60 of file metric_value.hpp.
|
inlinenoexcept |
Returns whether metric is HistogramView metric.
Definition at line 70 of file metric_value.hpp.
|
inlinenoexcept |
Returns whether metric is Rate metric.
Definition at line 63 of file metric_value.hpp.
|
inline |
Calls visitor with either a std::int64_t or a double value.
visitor returns. Definition at line 75 of file metric_value.hpp.
|
friend |
Definition at line 48 of file metric_value.hpp.
|
friend |
Definition at line 46 of file metric_value.hpp.