Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::prometheus::PrometheusInterface Class Referenceabstract

Interface for prometheus (https://prometheus.io/) More...

#include <Prometheus.hpp>

Inheritance diagram for util::prometheus::PrometheusInterface:

Public Member Functions

 PrometheusInterface (bool isEnabled, bool compressReply)
 Construct a new Prometheus Interface object.
 
virtual Bool boolMetric (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0
 Get a bool based metric. It will be created if it doesn't exist.
 
virtual CounterIntcounterInt (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0
 Get an integer based counter metric. It will be created if it doesn't exist.
 
virtual CounterDoublecounterDouble (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0
 Get a double based counter metric. It will be created if it doesn't exist.
 
virtual GaugeIntgaugeInt (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0
 Get an integer based gauge metric. It will be created if it doesn't exist.
 
virtual GaugeDoublegaugeDouble (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0
 Get a double based gauge metric. It will be created if it doesn't exist.
 
virtual HistogramInthistogramInt (std::string name, Labels labels, std::vector< std::int64_t > const &buckets, std::optional< std::string > description=std::nullopt)=0
 Get an integer based histogram metric. It will be created if it doesn't exist.
 
virtual HistogramDoublehistogramDouble (std::string name, Labels labels, std::vector< double > const &buckets, std::optional< std::string > description=std::nullopt)=0
 Get a double based histogram metric. It will be created if it doesn't exist.
 
virtual std::string collectMetrics ()=0
 Collect all metrics and return them as a string in Prometheus format.
 
bool isEnabled () const
 Whether prometheus is enabled.
 
bool compressReplyEnabled () const
 Whether to compress the reply.
 

Detailed Description

Interface for prometheus (https://prometheus.io/)

Constructor & Destructor Documentation

◆ PrometheusInterface()

util::prometheus::PrometheusInterface::PrometheusInterface ( bool isEnabled,
bool compressReply )
inline

Construct a new Prometheus Interface object.

Parameters
isEnabledWhether prometheus is enabled
compressReplyWhether to compress the reply

Member Function Documentation

◆ boolMetric()

virtual Bool util::prometheus::PrometheusInterface::boolMetric ( std::string name,
Labels labels,
std::optional< std::string > description = std::nullopt )
pure virtual

Get a bool based metric. It will be created if it doesn't exist.

Note
Prometheus does not have a native bool type, so we use a counter with a value of 0 or 1
Parameters
nameThe name of the metric
labelsThe labels of the metric
descriptionThe description of the metric
Returns
The bool object

Implemented in util::prometheus::PrometheusImpl.

◆ collectMetrics()

virtual std::string util::prometheus::PrometheusInterface::collectMetrics ( )
pure virtual

Collect all metrics and return them as a string in Prometheus format.

Returns
The serialized metrics

Implemented in util::prometheus::PrometheusImpl.

◆ compressReplyEnabled()

bool util::prometheus::PrometheusInterface::compressReplyEnabled ( ) const
inline

Whether to compress the reply.

Returns
true if the reply should be compressed

◆ counterDouble()

virtual CounterDouble & util::prometheus::PrometheusInterface::counterDouble ( std::string name,
Labels labels,
std::optional< std::string > description = std::nullopt )
pure virtual

Get a double based counter metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
descriptionThe description of the metric
Returns
A reference to the counter object

Implemented in util::prometheus::PrometheusImpl.

◆ counterInt()

virtual CounterInt & util::prometheus::PrometheusInterface::counterInt ( std::string name,
Labels labels,
std::optional< std::string > description = std::nullopt )
pure virtual

Get an integer based counter metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
descriptionThe description of the metric
Returns
A reference to the counter object

Implemented in util::prometheus::PrometheusImpl.

◆ gaugeDouble()

virtual GaugeDouble & util::prometheus::PrometheusInterface::gaugeDouble ( std::string name,
Labels labels,
std::optional< std::string > description = std::nullopt )
pure virtual

Get a double based gauge metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
descriptionThe description of the metric
Returns
A reference to the gauge object

Implemented in util::prometheus::PrometheusImpl.

◆ gaugeInt()

virtual GaugeInt & util::prometheus::PrometheusInterface::gaugeInt ( std::string name,
Labels labels,
std::optional< std::string > description = std::nullopt )
pure virtual

Get an integer based gauge metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
descriptionThe description of the metric
Returns
A reference to the gauge object

Implemented in util::prometheus::PrometheusImpl.

◆ histogramDouble()

virtual HistogramDouble & util::prometheus::PrometheusInterface::histogramDouble ( std::string name,
Labels labels,
std::vector< double > const & buckets,
std::optional< std::string > description = std::nullopt )
pure virtual

Get a double based histogram metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
bucketsThe buckets of the metric
descriptionThe description of the metric
Returns
A reference to the histogram object

Implemented in util::prometheus::PrometheusImpl.

◆ histogramInt()

virtual HistogramInt & util::prometheus::PrometheusInterface::histogramInt ( std::string name,
Labels labels,
std::vector< std::int64_t > const & buckets,
std::optional< std::string > description = std::nullopt )
pure virtual

Get an integer based histogram metric. It will be created if it doesn't exist.

Parameters
nameThe name of the metric
labelsThe labels of the metric
bucketsThe buckets of the metric
descriptionThe description of the metric
Returns
A reference to the histogram object

Implemented in util::prometheus::PrometheusImpl.

◆ isEnabled()

bool util::prometheus::PrometheusInterface::isEnabled ( ) const
inline

Whether prometheus is enabled.

Returns
true if prometheus is enabled

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