#include <userver/utils/statistics/metric_tag.hpp>
Metric description and registration in a declarative way.
Use MetricTag<Metric>
for declarative style of metric registration and call MetricStorage::GetMetric
for accessing metric data. Please note that metrics can be accessed from multiple coroutines, so Metric
must be thread-safe (e.g. std::atomic<T>, rcu::Variable<T>, rcu::RcuMap<T>, concurrent::Variable<T>, etc.).
A custom metric type must be default-constructible and have the following free function defined:
For alerts consider using alerts::Source.
where Stats
are defined in a following way:
For a full usage example see samples/tcp_full_duplex_service/main.cpp
Definition at line 40 of file metric_tag.hpp.
Public Member Functions | |
template<typename... Args> | |
MetricTag (std::string path, Args &&... args) | |
Register metric, passing a copy of args to the constructor of Metric | |
std::string | GetPath () const |
|
inlineexplicit |
Register metric, passing a copy of args
to the constructor of Metric
Definition at line 44 of file metric_tag.hpp.
|
inline |
Definition at line 48 of file metric_tag.hpp.
|
friend |
Definition at line 51 of file metric_tag.hpp.