Kagome
Polkadot Runtime Engine in C++17
kagome::metrics::PrometheusRegistry Class Reference

#include <registry_impl.hpp>

Inheritance diagram for kagome::metrics::PrometheusRegistry:
Collaboration diagram for kagome::metrics::PrometheusRegistry:

Public Member Functions

void setHandler (Handler &handler) override
 
void registerCounterFamily (const std::string &name, const std::string &help, const std::map< std::string, std::string > &labels) override
 
void registerGaugeFamily (const std::string &name, const std::string &help, const std::map< std::string, std::string > &labels) override
 
void registerHistogramFamily (const std::string &name, const std::string &help, const std::map< std::string, std::string > &labels) override
 
void registerSummaryFamily (const std::string &name, const std::string &help, const std::map< std::string, std::string > &labels) override
 
CounterregisterCounterMetric (const std::string &name, const std::map< std::string, std::string > &labels) override
 create counter metrics object More...
 
GaugeregisterGaugeMetric (const std::string &name, const std::map< std::string, std::string > &labels) override
 create gauge metrics object More...
 
HistogramregisterHistogramMetric (const std::string &name, const std::vector< double > &bucket_boundaries, const std::map< std::string, std::string > &labels) override
 create histogram metrics object More...
 
SummaryregisterSummaryMetric (const std::string &name, const std::vector< std::pair< double, double >> &quantiles, std::chrono::milliseconds max_age, int age_buckets, const std::map< std::string, std::string > &labels) override
 create summary metrics object More...
 
- Public Member Functions inherited from kagome::metrics::Registry
virtual ~Registry ()=default
 

Static Public Member Functions

template<typename T >
static MetricInfo< T >::type * internalMetric (T *metric)
 

Private Member Functions

template<typename T >
void registerFamily (const std::string &name, const std::string &help="", const std::map< std::string, std::string > &labels={})
 
template<typename T , typename... Args>
T * registerMetric (const std::string &name, const std::map< std::string, std::string > &labels, Args...args)
 

Static Private Member Functions

static std::shared_ptr< prometheus::Registry > registry ()
 

Private Attributes

std::unordered_map< std::string, std::reference_wrapper< prometheus::Collectable > > family_
 
std::tuple< std::forward_list< PrometheusCounter >, std::forward_list< PrometheusGauge >, std::forward_list< PrometheusHistogram >, std::forward_list< PrometheusSummary > > metrics_
 

Friends

class PrometheusHandler
 

Detailed Description

Definition at line 69 of file registry_impl.hpp.

Member Function Documentation

template<typename T >
static MetricInfo<T>::type* kagome::metrics::PrometheusRegistry::internalMetric ( T *  metric)
inlinestatic

Definition at line 161 of file registry_impl.hpp.

void kagome::metrics::PrometheusRegistry::registerCounterFamily ( const std::string &  name,
const std::string &  help,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

Implements kagome::metrics::Registry.

Definition at line 21 of file registry_impl.cpp.

Counter * kagome::metrics::PrometheusRegistry::registerCounterMetric ( const std::string &  name,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

create counter metrics object

Parameters
namethe name given at call registerCounterFamily
Returns
pointer without ownership
Note
avoid calling before registerCounterFamily

Implements kagome::metrics::Registry.

Definition at line 49 of file registry_impl.cpp.

template<typename T >
void kagome::metrics::PrometheusRegistry::registerFamily ( const std::string &  name,
const std::string &  help = "",
const std::map< std::string, std::string > &  labels = {} 
)
inlineprivate

Definition at line 85 of file registry_impl.hpp.

void kagome::metrics::PrometheusRegistry::registerGaugeFamily ( const std::string &  name,
const std::string &  help,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

Implements kagome::metrics::Registry.

Definition at line 28 of file registry_impl.cpp.

Gauge * kagome::metrics::PrometheusRegistry::registerGaugeMetric ( const std::string &  name,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

create gauge metrics object

Parameters
namethe name given at call registerGaugeFamily
Returns
pointer without ownership
Note
avoid calling before registerGaugeFamily

Implements kagome::metrics::Registry.

Definition at line 55 of file registry_impl.cpp.

void kagome::metrics::PrometheusRegistry::registerHistogramFamily ( const std::string &  name,
const std::string &  help,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

Implements kagome::metrics::Registry.

Definition at line 35 of file registry_impl.cpp.

Histogram * kagome::metrics::PrometheusRegistry::registerHistogramMetric ( const std::string &  name,
const std::vector< double > &  bucket_boundaries,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

create histogram metrics object

Parameters
namethe name given at call registerHistogramFamily
bucket_boundariesa list of monotonically increasing values
Returns
pointer without ownership See https://prometheus.io/docs/practices/histograms/ for detailed explanations of histogram usage and differences to summaries.
Note
avoid calling before registerHistogramFamily

Implements kagome::metrics::Registry.

Definition at line 61 of file registry_impl.cpp.

template<typename T , typename... Args>
T* kagome::metrics::PrometheusRegistry::registerMetric ( const std::string &  name,
const std::map< std::string, std::string > &  labels,
Args...  args 
)
inlineprivate

Definition at line 98 of file registry_impl.hpp.

void kagome::metrics::PrometheusRegistry::registerSummaryFamily ( const std::string &  name,
const std::string &  help,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

Implements kagome::metrics::Registry.

Definition at line 42 of file registry_impl.cpp.

Summary * kagome::metrics::PrometheusRegistry::registerSummaryMetric ( const std::string &  name,
const std::vector< std::pair< double, double >> &  quantiles,
std::chrono::milliseconds  max_age,
int  age_buckets,
const std::map< std::string, std::string > &  labels 
)
overridevirtual

create summary metrics object

Parameters
namethe name given at call registerSummaryFamily
quantilesa list of pairs denoting an error
max_ageduration of time window
age_bucketsnumber of buckets of the time window
Returns
pointer without ownership See https://prometheus.io/docs/practices/histograms/ for detailed explanations of Phi-quantiles, summary usage, and differences to histograms.
Note
avoid calling before registerSummaryFamily

Implements kagome::metrics::Registry.

Definition at line 68 of file registry_impl.cpp.

static std::shared_ptr<prometheus::Registry> kagome::metrics::PrometheusRegistry::registry ( )
inlinestaticprivate

Definition at line 109 of file registry_impl.hpp.

void kagome::metrics::PrometheusRegistry::setHandler ( Handler handler)
overridevirtual

Implements kagome::metrics::Registry.

Definition at line 17 of file registry_impl.cpp.

Friends And Related Function Documentation

friend class PrometheusHandler
friend

Definition at line 70 of file registry_impl.hpp.

Member Data Documentation

std::unordered_map<std::string, std::reference_wrapper<prometheus::Collectable> > kagome::metrics::PrometheusRegistry::family_
private

Definition at line 75 of file registry_impl.hpp.

std::tuple<std::forward_list<PrometheusCounter>, std::forward_list<PrometheusGauge>, std::forward_list<PrometheusHistogram>, std::forward_list<PrometheusSummary> > kagome::metrics::PrometheusRegistry::metrics_
private

Definition at line 81 of file registry_impl.hpp.


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