|
prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
|
MetricCore (the shared per-series state) and the CRTP MetricBase that gives every metric type value semantics and lazy binding.
More...
#include <prom/adapter.hpp>#include <prom/dimval.hpp>#include <prom/global.hpp>#include <prom/labels.hpp>#include <prom/unit.hpp>#include <logman/logman.hpp>#include <atomic>#include <cstdint>#include <memory>#include <mutex>#include <string>#include <string_view>#include <utility>#include <vector>

Go to the source code of this file.
Classes | |
| class | prom::ScopeState |
| Read-only view a scoped metric uses to re-resolve its name, constant labels, and display metadata against the live scope configuration on every use. More... | |
| class | prom::detail::DecorationState |
| A live, thread-safe metric decoration — a name prefix, default constant labels, and default display metadata — with a version that advances on every change. More... | |
| struct | prom::MetricCore |
| Shared, reference-counted state behind every metric handle. More... | |
| struct | prom::MetricCore::Bound |
| class | prom::MetricBase< Derived > |
| CRTP base shared by every metric type. More... | |
| struct | prom::MetricBase< Derived >::Binding |
A resolved (adapter, handle) snapshot — the result of bind(). More... | |
Namespaces | |
| namespace | prom |
| namespace | prom::detail |
Portable atomic shared_ptr<const T> exposing just load()/store(). | |
Functions | |
| comms::DisplayInfo | prom::detail::merge_display (const comms::DisplayInfo &base, const comms::DisplayInfo &over) |
| Overlay a metric's own display fields onto a set of defaults; each per-metric field that is set wins over the default. | |
| bool | prom::detail::display_empty (const comms::DisplayInfo &display) noexcept |
Whether a DisplayInfo carries any field at all. | |
| std::shared_ptr< DecorationState > | prom::detail::global_decoration () |
The process-wide decoration shared by Registry::global(), every standalone metric, and (as their chain parent) every Scope. | |
MetricCore (the shared per-series state) and the CRTP MetricBase that gives every metric type value semantics and lazy binding.
A metric handle is a cheap, copyable value type that holds a shared_ptr<MetricCore>. Copies refer to the same series. A metric is created in one of two states:
(name, help) (or a spec) and unbound. On first use it binds to the adapter currently installed on the process-wide cell and registers itself. Copies of an unbound metric all resolve to the same series.Registry (or by labels()), eagerly registered against its source's current adapter.Every core reads its adapter from an AdapterSource (the cell of its registry, or the global cell). When that source's version() advances — an adapter swap — or, for a scoped metric, when the scope's version() advances, the core re-registers against the new adapter/config on its next use. Labeled children are pinned: they snapshot their binding at creation and never migrate. After binding, the hot path is a single relaxed load plus a virtual call into the adapter.