|
prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
|
The pluggable backend. More...
#include <adapter.hpp>

Public Member Functions | |
| Adapter ()=default | |
| Adapter (const Adapter &)=delete | |
| Adapter & | operator= (const Adapter &)=delete |
| Adapter (Adapter &&)=delete | |
| Adapter & | operator= (Adapter &&)=delete |
| virtual | ~Adapter ()=default |
| virtual std::string_view | backend_name () const noexcept=0 |
Stable identifier of the backend (e.g. "null", "prometheus-cpp"). | |
| virtual MetricHandle | register_metric (const MetricMeta &meta) noexcept=0 |
| Register a metric family. | |
| virtual MetricHandle | resolve (const MetricHandle &family, const Labels &dynamic) noexcept=0 |
Resolve the labeled child of family for the given dynamic labels, creating it on first request. | |
| virtual void | inc (const MetricHandle &handle, double amount) noexcept=0 |
Increase the series behind handle by amount (counter/gauge). | |
| virtual void | dec (const MetricHandle &handle, double amount) noexcept=0 |
Decrease the series behind handle by amount (gauge). | |
| virtual void | set (const MetricHandle &handle, double value) noexcept=0 |
Set the series behind handle to value (gauge/untyped). | |
| virtual void | observe (const MetricHandle &handle, double value) noexcept=0 |
Record an observation against handle (histogram/summary). | |
| virtual void | set_info (const MetricHandle &handle, std::span< const Label > labels) noexcept=0 |
| Replace the label set carried by an info metric. | |
| virtual void | set_state (const MetricHandle &handle, std::string_view state, bool active) noexcept=0 |
| Set the boolean value of one member of a state set. | |
| virtual void | set_unit (const MetricHandle &, const Unit &) noexcept |
| Late unit inference hook. | |
The pluggable backend.
Non-copyable, non-movable: an Adapter is owned through a shared_ptr and referenced by every metric bound to it.
Threading contract. Every method may be called concurrently from any thread. Backends are responsible for their own synchronization. No method throws — failures are absorbed (and ideally logged) by the backend.
|
default |
|
delete |
|
delete |
|
virtualdefault |
|
pure virtualnoexcept |
Stable identifier of the backend (e.g. "null", "prometheus-cpp").
Implemented in prom::prometheus_cpp::PrometheusCppAdapter, prom::CompositeAdapter, and prom::NullAdapter.
|
pure virtualnoexcept |
Decrease the series behind handle by amount (gauge).
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Increase the series behind handle by amount (counter/gauge).
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Record an observation against handle (histogram/summary).
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Register a metric family.
Must return a non-null handle even on failure (fall back to an inert handle) so callers never have to null-check.
Implemented in prom::CompositeAdapter, prom::NullAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Resolve the labeled child of family for the given dynamic labels, creating it on first request.
The backend owns the child cache. Must return a non-null handle.
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Set the series behind handle to value (gauge/untyped).
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Replace the label set carried by an info metric.
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
pure virtualnoexcept |
Set the boolean value of one member of a state set.
Implemented in prom::NullAdapter, prom::CompositeAdapter, and prom::prometheus_cpp::PrometheusCppAdapter.
|
inlinevirtualnoexcept |
Late unit inference hook.
Called when a metric that declared no unit latches the unit of its first dimensional observation. Optional — backends that cannot rename a registered series may ignore it.
Reimplemented in prom::NullAdapter, and prom::CompositeAdapter.