prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
Loading...
Searching...
No Matches
Public Member Functions | List of all members
prom::Gauge Class Reference

A gauge. More...

#include <gauge.hpp>

Inheritance diagram for prom::Gauge:
Inheritance graph
[legend]
Collaboration diagram for prom::Gauge:
Collaboration graph
[legend]

Public Member Functions

 Gauge (const std::string_view name, const std::string_view help)
 
 Gauge (const GaugeSpec &spec)
 
 Gauge (std::shared_ptr< MetricCore > core)
 
template<class T >
requires std::is_arithmetic_v<T>
void set (T value) noexcept
 Set the gauge to a raw value.
 
template<DimensionalValue V>
void set (const V &value) noexcept
 Set the gauge to a dimensional value.
 
void inc () noexcept
 Increment by one.
 
template<class T >
requires std::is_arithmetic_v<T>
void inc (T amount) noexcept
 Increment by a raw amount.
 
template<DimensionalValue V>
void inc (const V &amount) noexcept
 Increment by a dimensional amount.
 
void dec () noexcept
 Decrement by one.
 
template<class T >
requires std::is_arithmetic_v<T>
void dec (T amount) noexcept
 Decrement by a raw amount.
 
template<DimensionalValue V>
void dec (const V &amount) noexcept
 Decrement by a dimensional amount.
 
Gauge labels (const Labels &dynamic) const noexcept
 
- Public Member Functions inherited from prom::MetricBase< Gauge >
std::string_view name () const noexcept
 The metric's fully-qualified name.
 
MetricType type () const noexcept
 The metric kind.
 

Additional Inherited Members

- Protected Member Functions inherited from prom::MetricBase< Gauge >
 MetricBase (const MetricType type, const std::string_view name, const std::string_view help)
 Standalone, unbound construction from a name and help string.
 
 MetricBase (std::shared_ptr< MetricCore > core)
 Adopt an already-populated core (registered metrics and children).
 
 MetricBase (const MetricBase &)=default
 
 MetricBase (MetricBase &&)=default
 
MetricBaseoperator= (const MetricBase &)=default
 
MetricBaseoperator= (MetricBase &&)=default
 
 ~MetricBase ()=default
 
Binding bind () const noexcept
 Resolve the adapter and backend handle this metric should record against.
 
const std::shared_ptr< MetricCore > & core () const noexcept
 
Gauge make_child (const Labels &dynamic) const noexcept
 Resolve a labeled child of the same metric type.
 
bool reconcile_unit (const Unit &observed, Adapter &adapter) const noexcept
 Reconcile an observed unit against the family's known unit.
 
bool check_finite (const double value, std::string_view op) const noexcept
 Drop-and-log guard for a non-finite sample.
 
- Static Protected Member Functions inherited from prom::MetricBase< Gauge >
static spdlog::logger * logger () noexcept
 The shared per-process metrics logger.
 
- Protected Attributes inherited from prom::MetricBase< Gauge >
std::shared_ptr< MetricCorecore_
 

Detailed Description

A gauge.

Supports set, inc, and dec with raw or dimensional values, plus the no-argument inc()/dec() for +/-1.

Constructor & Destructor Documentation

◆ Gauge() [1/3]

prom::Gauge::Gauge ( const std::string_view  name,
const std::string_view  help 
)
inline

◆ Gauge() [2/3]

prom::Gauge::Gauge ( const GaugeSpec spec)
inlineexplicit

◆ Gauge() [3/3]

prom::Gauge::Gauge ( std::shared_ptr< MetricCore core)
inlineexplicit

Member Function Documentation

◆ dec() [1/3]

void prom::Gauge::dec ( )
inlinenoexcept

Decrement by one.

◆ dec() [2/3]

template<DimensionalValue V>
void prom::Gauge::dec ( const V &  amount)
inlinenoexcept

Decrement by a dimensional amount.

◆ dec() [3/3]

template<class T >
requires std::is_arithmetic_v<T>
void prom::Gauge::dec ( amount)
inlinenoexcept

Decrement by a raw amount.

◆ inc() [1/3]

void prom::Gauge::inc ( )
inlinenoexcept

Increment by one.

◆ inc() [2/3]

template<DimensionalValue V>
void prom::Gauge::inc ( const V &  amount)
inlinenoexcept

Increment by a dimensional amount.

◆ inc() [3/3]

template<class T >
requires std::is_arithmetic_v<T>
void prom::Gauge::inc ( amount)
inlinenoexcept

Increment by a raw amount.

◆ labels()

Gauge prom::Gauge::labels ( const Labels dynamic) const
inlinenoexcept

◆ set() [1/2]

template<DimensionalValue V>
void prom::Gauge::set ( const V &  value)
inlinenoexcept

Set the gauge to a dimensional value.

◆ set() [2/2]

template<class T >
requires std::is_arithmetic_v<T>
void prom::Gauge::set ( value)
inlinenoexcept

Set the gauge to a raw value.


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