Github   Telegram
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
utils::statistics::MetricTag< Metric > Class Template Referencefinal

Metric description. More...

#include <userver/utils/statistics/metric_tag.hpp>

Public Member Functions

 MetricTag (const std::string &path)
 Register metric. More...
 
std::string GetPath () const
 

Friends

class MetricsStorage
 

Detailed Description

template<typename Metric>
class utils::statistics::MetricTag< Metric >

Metric description.

Use MetricTag<Metric> for declarative style of metric registration and call MetricStorage::GetMetric<Metric>() 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.).

For custom type of Metric you have to define method to dump your type to JSON:

formats::json::ValueBuilder DumpMetric(const Metric& m);
Examples
samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp, and samples/testsuite-support/src/metrics.cpp.

Definition at line 26 of file metric_tag.hpp.

Constructor & Destructor Documentation

◆ MetricTag()

template<typename Metric >
utils::statistics::MetricTag< Metric >::MetricTag ( const std::string &  path)
inlineexplicit

Register metric.

Definition at line 29 of file metric_tag.hpp.

Member Function Documentation

◆ GetPath()

template<typename Metric >
std::string utils::statistics::MetricTag< Metric >::GetPath ( ) const
inline

Definition at line 33 of file metric_tag.hpp.

Friends And Related Function Documentation

◆ MetricsStorage

template<typename Metric >
friend class MetricsStorage
friend

Definition at line 36 of file metric_tag.hpp.


The documentation for this class was generated from the following file: