13#include <logman/logman.hpp>
28 [[nodiscard]] std::string_view
backend_name() const noexcept
override {
35 "register_metric type={} name={} (no-op)",
to_string(meta.type), meta.name);
41 const Labels& dynamic)
noexcept override {
43 logger_->trace(
"resolve labels={} (no-op)", dynamic.size());
61 trace(
"observe", value);
65 const std::span<const Label> labels)
noexcept override {
67 logger_->trace(
"set_info labels={} (no-op)", labels.size());
72 std::string_view state,
73 bool active)
noexcept override {
75 logger_->trace(
"set_state {}={} (no-op)", state, active);
81 logger_->trace(
"set_unit {} (no-op)", unit.name);
86 void trace(std::string_view op,
double value)
const noexcept {
88 logger_->trace(
"{} {} (no-op)", op, value);
92 std::shared_ptr<spdlog::logger> logger_;
The pluggable backend.
Definition adapter.hpp:62
An immutable-by-convention set of labels, kept sorted by name with duplicates collapsed last-wins.
Definition labels.hpp:55
Opaque backend state for a registered family or a labeled child.
Definition adapter.hpp:46
A backend that records nothing.
Definition null_adapter.hpp:24
void dec(const MetricHandle &, const double amount) noexcept override
Decrease the series behind handle by amount (gauge).
Definition null_adapter.hpp:52
MetricHandle register_metric(const MetricMeta &meta) noexcept override
Register a metric family.
Definition null_adapter.hpp:32
void set_info(const MetricHandle &, const std::span< const Label > labels) noexcept override
Replace the label set carried by an info metric.
Definition null_adapter.hpp:64
void observe(const MetricHandle &, const double value) noexcept override
Record an observation against handle (histogram/summary).
Definition null_adapter.hpp:60
void set_state(const MetricHandle &, std::string_view state, bool active) noexcept override
Set the boolean value of one member of a state set.
Definition null_adapter.hpp:71
MetricHandle resolve(const MetricHandle &, const Labels &dynamic) noexcept override
Resolve the labeled child of family for the given dynamic labels, creating it on first request.
Definition null_adapter.hpp:40
void inc(const MetricHandle &, const double amount) noexcept override
Increase the series behind handle by amount (counter/gauge).
Definition null_adapter.hpp:48
NullAdapter()
Definition null_adapter.hpp:26
void set_unit(const MetricHandle &, const Unit &unit) noexcept override
Late unit inference hook.
Definition null_adapter.hpp:79
void set(const MetricHandle &, const double value) noexcept override
Set the series behind handle to value (gauge/untyped).
Definition null_adapter.hpp:56
std::string_view backend_name() const noexcept override
Stable identifier of the backend (e.g. "null", "prometheus-cpp").
Definition null_adapter.hpp:28
The backend boundary: MetricMeta, MetricState/MetricHandle, and the pure-virtual Adapter interface.
Definition adapter.hpp:24
constexpr std::string_view to_string(const ErrorCode code) noexcept
Human-readable spelling of an ErrorCode.
Definition error.hpp:36
std::shared_ptr< MetricState > MetricHandle
Opaque, backend-owned handle to a registered metric family or a labeled child series.
Definition fwd.hpp:34
OpenMetrics unit suffix plus optional dimensional metadata.
Definition unit.hpp:53