|
prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
|
A named, reconfigurable metrics instance for one library. More...
#include <scope.hpp>


Public Member Functions | |
| Scope (ScopeConfig config={}) | |
| Counter | counter (const CounterSpec &spec) |
| Gauge | gauge (const GaugeSpec &spec) |
| Histogram | histogram (const HistogramSpec &spec) |
| Summary | summary (const SummarySpec &spec) |
| Untyped | untyped (const UntypedSpec &spec) |
| Info | info (const InfoSpec &spec) |
| StateSet | stateset (const StateSetSpec &spec) |
| std::string | prefix () const |
| void | set_prefix (std::string prefix) |
| Labels | const_labels () const |
| void | set_const_labels (Labels labels) |
| void | add_const_label (std::string name, std::string value) |
| comms::DisplayInfo | display () const |
| void | set_display (comms::DisplayInfo display) |
| ScopeConfig | config () const |
| A snapshot of the whole configuration. | |
| void | configure (ScopeConfig config) |
| Replace the whole configuration at once. | |
| std::uint64_t | version () const noexcept override |
| Monotonic counter, bumped on every configuration change. | |
| std::string | full_name (const std::string_view base) const override |
| The effective metric name for a base (un-prefixed) name. | |
| Labels | effective_labels (const Labels &own) const override |
| The effective constant labels for a metric's own labels. | |
| comms::DisplayInfo | effective_display (const comms::DisplayInfo &own) const override |
| The effective display metadata for a metric's own display. | |
| bool | decorates () const noexcept override |
| Whether this decoration actually changes anything (a non-empty prefix, constant labels, or display — directly or via a parent it chains onto). | |
| std::vector< MetricInfo > | metrics () const |
| Snapshots describing every (still-alive) metric created through this scope, including declared-but-unused ones; the effective name and labels are computed live from the current scope config. | |
Public Member Functions inherited from prom::ScopeState | |
| ScopeState ()=default | |
| ScopeState (const ScopeState &)=delete | |
| ScopeState & | operator= (const ScopeState &)=delete |
| ScopeState (ScopeState &&)=delete | |
| ScopeState & | operator= (ScopeState &&)=delete |
| virtual | ~ScopeState ()=default |
A named, reconfigurable metrics instance for one library.
Create/retrieve it with prom::scope(...) (or prom::Registry::scope(...)); it is held by shared_ptr so the metrics created from it keep it alive.
|
inlineexplicit |
|
inline |
|
inline |
A snapshot of the whole configuration.
|
inline |
Replace the whole configuration at once.
|
inline |
|
inline |
|
inlineoverridevirtualnoexcept |
Whether this decoration actually changes anything (a non-empty prefix, constant labels, or display — directly or via a parent it chains onto).
Drives the scoped flag on MetricInfo: an empty decoration leaves a metric reported as un-decorated.
Implements prom::ScopeState.
|
inline |
|
inlineoverridevirtual |
The effective display metadata for a metric's own display.
Implements prom::ScopeState.
The effective constant labels for a metric's own labels.
Implements prom::ScopeState.
|
inlineoverridevirtual |
The effective metric name for a base (un-prefixed) name.
Implements prom::ScopeState.
|
inline |
|
inline |
Snapshots describing every (still-alive) metric created through this scope, including declared-but-unused ones; the effective name and labels are computed live from the current scope config.
Expired entries are pruned. Kept separate from Registry::global()->metrics().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtualnoexcept |
Monotonic counter, bumped on every configuration change.
Implements prom::ScopeState.