Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::prometheus::AnyHistogram< NumberType > Class Template Reference

A Prometheus histogram metric with a generic value type. More...

#include <Histogram.hpp>

Inheritance diagram for util::prometheus::AnyHistogram< NumberType >:
Collaboration diagram for util::prometheus::AnyHistogram< NumberType >:

Public Types

using ValueType = NumberType
 
using Buckets = std::vector<NumberType>
 

Public Member Functions

template<impl::SomeHistogramImpl ImplType = impl::HistogramImpl<ValueType>>
requires std::same_as<ValueType, typename std::remove_cvref_t<ImplType>::ValueType>
 AnyHistogram (std::string name, std::string labelsString, Buckets const &buckets, ImplType &&impl=ImplType{})
 Construct a new Histogram object.
 
void observe (ValueType const value)
 Add a value to the histogram.
 
void serializeValue (OStream &stream) const override
 Serialize the metric to a string in Prometheus format.
 
- Public Member Functions inherited from util::prometheus::MetricBase
 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"}.
 

Additional Inherited Members

- Protected Member Functions inherited from util::prometheus::MetricBase

Detailed Description

template<SomeNumberType NumberType>
class util::prometheus::AnyHistogram< NumberType >

A Prometheus histogram metric with a generic value type.

Template Parameters
NumberTypeThe number type of the histogram

Constructor & Destructor Documentation

◆ AnyHistogram()

template<SomeNumberType NumberType>
template<impl::SomeHistogramImpl ImplType = impl::HistogramImpl<ValueType>>
requires std::same_as<ValueType, typename std::remove_cvref_t<ImplType>::ValueType>
util::prometheus::AnyHistogram< NumberType >::AnyHistogram ( std::string name,
std::string labelsString,
Buckets const & buckets,
ImplType && impl = ImplType{} )
inline

Construct a new Histogram object.

Template Parameters
ImplTypeThe type of the implementation of the histogram
Parameters
nameThe name of the metric
labelsStringThe labels of the metric in serialized format, e.g. {name="value",name2="value2"}
bucketsThe buckets of the histogram
implThe implementation of the histogram (has default value and need to be specified only for testing)

Member Function Documentation

◆ observe()

template<SomeNumberType NumberType>
void util::prometheus::AnyHistogram< NumberType >::observe ( ValueType const value)
inline

Add a value to the histogram.

Parameters
valueThe value to add

◆ serializeValue()

template<SomeNumberType NumberType>
void util::prometheus::AnyHistogram< NumberType >::serializeValue ( OStream & stream) const
inlineoverridevirtual

Serialize the metric to a string in Prometheus format.

Parameters
streamThe stream to serialize into

Implements util::prometheus::MetricBase.


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