userver: utils::statistics::MetricTag< Metric > Class Template Reference
No Matches
utils::statistics::MetricTag< Metric > Class Template Referencefinal

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

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 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:

void DumpMetric(utils::statistics::Writer&, const Metric&)
samples/tcp_full_duplex_service/tcp_full_duplex_service.cpp, and samples/testsuite-support/src/metrics.cpp.

Definition at line 27 of file metric_tag.hpp.

Public Member Functions

template<typename... Args>
 MetricTag (const std::string &path, Args &&... args)
 Register metric, passing a copy of args to the constructor of Metric
std::string GetPath () const

Constructor & Destructor Documentation

◆ MetricTag()

template<typename Metric >
template<typename... Args>
utils::statistics::MetricTag< Metric >::MetricTag ( const std::string & path,
Args &&... args )

Register metric, passing a copy of args to the constructor of Metric

Definition at line 31 of file metric_tag.hpp.

Member Function Documentation

◆ GetPath()

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

Definition at line 37 of file metric_tag.hpp.

Friends And Related Symbol Documentation

◆ MetricsStorage

template<typename Metric >
friend class MetricsStorage

Definition at line 40 of file metric_tag.hpp.

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