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

A prometheus gauge metric implementation. It can be increased, decreased or set to a value. More...

#include <Gauge.hpp>

Inheritance diagram for util::prometheus::AnyGauge< NumberType >:
Collaboration diagram for util::prometheus::AnyGauge< 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>
 AnyGauge (std::string name, std::string labelsString, ImplType &&impl=ImplType{})
 Construct a new AnyGauge object.
 
AnyGaugeoperator++ ()
 Increase the gauge by one.
 
AnyGaugeoperator-- ()
 Decrease the gauge by one.
 
AnyGaugeoperator+= (ValueType const value)
 Increase the gauge by the given value.
 
AnyGaugeoperator-= (ValueType const value)
 Decrease the gauge by the given value.
 
void set (ValueType const value)
 Set the gauge to the given value.
 
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::AnyGauge< NumberType >

A prometheus gauge metric implementation. It can be increased, decreased or set to a value.

Template Parameters
NumberTypeThe type of the value of the gauge

Constructor & Destructor Documentation

◆ AnyGauge()

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

Construct a new AnyGauge object.

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

Member Function Documentation

◆ operator++()

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

Increase the gauge by one.

Returns
Reference to self

◆ operator+=()

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

Increase the gauge by the given value.

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

◆ operator--()

template<SomeNumberType NumberType>
AnyGauge & util::prometheus::AnyGauge< NumberType >::operator-- ( )
inline

Decrease the gauge by one.

Returns
Reference to self

◆ operator-=()

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

Decrease the gauge by the given value.

Parameters
valueThe value to decrease the gauge by
Returns
Reference to self

◆ serializeValue()

template<SomeNumberType NumberType>
void util::prometheus::AnyGauge< 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::AnyGauge< NumberType >::set ( ValueType const value)
inline

Set the gauge to the given value.

Parameters
valueThe value to set the gauge to

◆ value()

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

Get the value of the counter.

Returns
The value of the counter

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