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

A prometheus counter metric implementation. It can only be increased or be reset to zero. More...

#include <Counter.hpp>

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

Public Types

using ValueType = NumberType
 
- Public Types inherited from util::prometheus::impl::AnyCounterBase< NumberType >
using ValueType = NumberType
 

Public Member Functions

template<impl::SomeCounterImpl ImplType = impl::CounterImpl<ValueType>>
requires std::same_as<ValueType, typename std::remove_cvref_t<ImplType>::ValueType>
 AnyCounter (std::string name, std::string labelsString, ImplType &&impl=ImplType{})
 Construct a new AnyCounter object.
 
AnyCounteroperator++ ()
 Increase the counter by one.
 
AnyCounteroperator+= (ValueType const value)
 Increase the counter by the given value.
 
void set (ValueType value)
 Set the value of the counter.
 
void reset ()
 Reset the counter to zero.
 
ValueType value () const
 Get the value of the counter.
 
void serializeValue (OStream &stream) const override
 Serialize the counter to a string in prometheus format (i.e. name{labels} value)
 
- 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"}.
 
- Public Member Functions inherited from util::prometheus::impl::AnyCounterBase< NumberType >
template<SomeCounterImpl ImplType = CounterImpl<ValueType>>
requires std::same_as<ValueType, typename std::remove_cvref_t<ImplType>::ValueType>
 AnyCounterBase (ImplType &&impl=ImplType{})
 

Additional Inherited Members

- Protected Member Functions inherited from util::prometheus::MetricBase
- Protected Attributes inherited from util::prometheus::impl::AnyCounterBase< NumberType >
std::unique_ptr< Conceptpimpl_
 

Detailed Description

template<SomeNumberType NumberType>
struct util::prometheus::AnyCounter< NumberType >

A prometheus counter metric implementation. It can only be increased or be reset to zero.

Template Parameters
NumberTypeThe type of the value of the counter

Constructor & Destructor Documentation

◆ AnyCounter()

template<SomeNumberType NumberType>
template<impl::SomeCounterImpl ImplType = impl::CounterImpl<ValueType>>
requires std::same_as<ValueType, typename std::remove_cvref_t<ImplType>::ValueType>
util::prometheus::AnyCounter< NumberType >::AnyCounter ( std::string name,
std::string labelsString,
ImplType && impl = ImplType{} )
inline

Construct a new AnyCounter object.

Template Parameters
ImplTypeThe type of the implementation of the counter
Parameters
nameThe name of the counter
labelsStringThe labels of the counter
implThe implementation of the counter

Member Function Documentation

◆ operator++()

template<SomeNumberType NumberType>
AnyCounter & util::prometheus::AnyCounter< NumberType >::operator++ ( )
inline

Increase the counter by one.

Returns
Reference to self

◆ operator+=()

template<SomeNumberType NumberType>
AnyCounter & util::prometheus::AnyCounter< NumberType >::operator+= ( ValueType const value)
inline

Increase the counter by the given value.

Parameters
valueThe value to increase the counter by
Returns
Reference to self

◆ serializeValue()

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

Serialize the counter to a string in prometheus format (i.e. name{labels} value)

Parameters
streamThe stream to serialize into

Implements util::prometheus::MetricBase.

◆ set()

template<SomeNumberType NumberType>
void util::prometheus::AnyCounter< NumberType >::set ( ValueType value)
inline

Set the value of the counter.

Parameters
valueThe value to set the counter to

◆ value()

template<SomeNumberType NumberType>
ValueType util::prometheus::AnyCounter< NumberType >::value ( ) const
inline

Get the value of the counter.

Returns
The value

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