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

Base class for a Prometheus metric containing a name and labels. More...

#include <MetricBase.hpp>

Inheritance diagram for util::prometheus::MetricBase:

Public Member Functions

 MetricBase (std::string name, std::string labelsString)
 Construct a new MetricBase object.
 
 MetricBase (MetricBase const &)=delete
 
 MetricBase (MetricBase &&)=default
 
MetricBaseoperator= (MetricBase const &)=delete
 
MetricBaseoperator= (MetricBase &&)=default
 
std::string const & name () const
 Get the name of the metric.
 
std::string const & labelsString () const
 Get the labels of the metric in serialized format, e.g. {name="value",name2="value2"}.
 

Protected Member Functions

virtual void serializeValue (OStream &stream) const =0
 Interface to serialize the value of the metric.
 

Friends

OStreamoperator<< (OStream &stream, MetricBase const &metricBase)
 Serialize the metric to a string in Prometheus format.
 

Detailed Description

Base class for a Prometheus metric containing a name and labels.

Constructor & Destructor Documentation

◆ MetricBase()

util::prometheus::MetricBase::MetricBase ( std::string name,
std::string labelsString )

Construct a new MetricBase object.

Parameters
nameThe name of the metric
labelsStringThe labels of the metric in serialized format, e.g. {name="value",name2="value2"}

Member Function Documentation

◆ labelsString()

std::string const & util::prometheus::MetricBase::labelsString ( ) const

Get the labels of the metric in serialized format, e.g. {name="value",name2="value2"}.

Returns
The labels of the metric

◆ name()

std::string const & util::prometheus::MetricBase::name ( ) const

Get the name of the metric.

Returns
The name of the metric

◆ serializeValue()

virtual void util::prometheus::MetricBase::serializeValue ( OStream & stream) const
protectedpure virtual

Interface to serialize the value of the metric.

Parameters
streamThe stream to serialize into

Implemented in util::prometheus::AnyCounter< NumberType >, util::prometheus::AnyGauge< NumberType >, and util::prometheus::AnyHistogram< NumberType >.

Friends And Related Symbol Documentation

◆ operator<<

OStream & operator<< ( OStream & stream,
MetricBase const & metricBase )
friend

Serialize the metric to a string in Prometheus format.

Parameters
streamThe stream to serialize into
metricBaseThe metric to serialize

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