|
prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
|
A backend that forwards every call to a fixed set of child adapters. More...
#include <composite_adapter.hpp>


Public Member Functions | |
| CompositeAdapter (std::vector< AdapterPtr > adapters) | |
| Construct from an explicit list of adapters. Null entries are ignored. | |
| CompositeAdapter (const std::initializer_list< AdapterPtr > adapters) | |
Convenience constructor: CompositeAdapter{a, b, c}. | |
| std::span< const AdapterPtr > | adapters () const noexcept |
| The wrapped adapters, in dispatch order (nulls already removed). | |
| std::string_view | backend_name () const noexcept override |
Stable identifier of the backend (e.g. "null", "prometheus-cpp"). | |
| MetricHandle | register_metric (const MetricMeta &meta) noexcept override |
| Register a metric family. | |
| MetricHandle | resolve (const MetricHandle &family, const Labels &dynamic) noexcept override |
Resolve the labeled child of family for the given dynamic labels, creating it on first request. | |
| void | inc (const MetricHandle &handle, const double amount) noexcept override |
Increase the series behind handle by amount (counter/gauge). | |
| void | dec (const MetricHandle &handle, const double amount) noexcept override |
Decrease the series behind handle by amount (gauge). | |
| void | set (const MetricHandle &handle, const double value) noexcept override |
Set the series behind handle to value (gauge/untyped). | |
| void | observe (const MetricHandle &handle, const double value) noexcept override |
Record an observation against handle (histogram/summary). | |
| void | set_info (const MetricHandle &handle, const std::span< const Label > labels) noexcept override |
| Replace the label set carried by an info metric. | |
| void | set_state (const MetricHandle &handle, const std::string_view state, const bool active) noexcept override |
| Set the boolean value of one member of a state set. | |
| void | set_unit (const MetricHandle &handle, const Unit &unit) noexcept override |
| Late unit inference hook. | |
Public Member Functions inherited from prom::Adapter | |
| Adapter ()=default | |
| Adapter (const Adapter &)=delete | |
| Adapter & | operator= (const Adapter &)=delete |
| Adapter (Adapter &&)=delete | |
| Adapter & | operator= (Adapter &&)=delete |
| virtual | ~Adapter ()=default |
A backend that forwards every call to a fixed set of child adapters.
The adapter list is captured at construction and never mutated afterwards, so — given that each child honours the Adapter threading contract — the composite itself needs no locking and is safe to call from any thread. Null entries in the supplied list are dropped so child indices stay dense.
|
inlineexplicit |
Construct from an explicit list of adapters. Null entries are ignored.
|
inline |
Convenience constructor: CompositeAdapter{a, b, c}.
|
inlinenoexcept |
The wrapped adapters, in dispatch order (nulls already removed).
|
inlineoverridevirtualnoexcept |
Stable identifier of the backend (e.g. "null", "prometheus-cpp").
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Decrease the series behind handle by amount (gauge).
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Increase the series behind handle by amount (counter/gauge).
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Record an observation against handle (histogram/summary).
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
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.
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
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.
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Set the series behind handle to value (gauge/untyped).
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Replace the label set carried by an info metric.
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
Set the boolean value of one member of a state set.
Implements prom::Adapter.
|
inlineoverridevirtualnoexcept |
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 from prom::Adapter.