TARAXA
taraxa::metrics::MetricsService Class Reference

class for metrics collecting. Registering specific metrics classes and creating prometheus server(exposer) More...

#include <metrics_service.hpp>

Public Member Functions

 MetricsService (const std::string &host, uint16_t port, uint16_t polling_interval_ms)
 
 ~MetricsService ()
 
void start ()
 method to start thread that collecting data from special classes More...
 
template<class T >
std::shared_ptr< T > getMetrics ()
 method to get specific metrics instance. Creates and registers instance if it is called for first time for specified type More...
 

Private Attributes

const uint16_t kPollingIntervalMs = 0
 
std::unique_ptr< prometheus::Exposer > exposer_
 
std::shared_ptr< prometheus::Registry > registry_
 
std::map< std::string, SharedMetricsGroupmetrics_
 
std::unique_ptr< std::thread > thread_
 

Detailed Description

class for metrics collecting. Registering specific metrics classes and creating prometheus server(exposer)

Constructor & Destructor Documentation

◆ MetricsService()

taraxa::metrics::MetricsService::MetricsService ( const std::string &  host,
uint16_t  port,
uint16_t  polling_interval_ms 
)

◆ ~MetricsService()

taraxa::metrics::MetricsService::~MetricsService ( )

Member Function Documentation

◆ getMetrics()

template<class T >
std::shared_ptr<T> taraxa::metrics::MetricsService::getMetrics ( )
inline

method to get specific metrics instance. Creates and registers instance if it is called for first time for specified type

Returns
ptr to specific metrics instance

◆ start()

void taraxa::metrics::MetricsService::start ( )

method to start thread that collecting data from special classes

Member Data Documentation

◆ exposer_

std::unique_ptr<prometheus::Exposer> taraxa::metrics::MetricsService::exposer_
private

◆ kPollingIntervalMs

const uint16_t taraxa::metrics::MetricsService::kPollingIntervalMs = 0
private

◆ metrics_

std::map<std::string, SharedMetricsGroup> taraxa::metrics::MetricsService::metrics_
private

◆ registry_

std::shared_ptr<prometheus::Registry> taraxa::metrics::MetricsService::registry_
private

◆ thread_

std::unique_ptr<std::thread> taraxa::metrics::MetricsService::thread_
private

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