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...
|
| | DecorationState ()=default |
| |
| | DecorationState (std::string prefix, Labels const_labels, comms::DisplayInfo display, std::shared_ptr< ScopeState > parent=nullptr) |
| |
| 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::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) |
| |
| void | configure (std::string prefix, Labels const_labels, comms::DisplayInfo display) |
| | Replace prefix, constant labels, and display in one shot (single version bump).
|
| |
| | ScopeState ()=default |
| |
| | ScopeState (const ScopeState &)=delete |
| |
| ScopeState & | operator= (const ScopeState &)=delete |
| |
| | ScopeState (ScopeState &&)=delete |
| |
| ScopeState & | operator= (ScopeState &&)=delete |
| |
| virtual | ~ScopeState ()=default |
| |
A live, thread-safe metric decoration — a name prefix, default constant labels, and default display metadata — with a version that advances on every change.
This is the engine behind both a prom::Scope and a prom::Registry: a metric core that points at one (via MetricCore::scope) re-resolves its effective name / labels / display whenever version() moves (see MetricBase::rebind), so mutating the decoration at runtime reconfigures every metric created against it.
A decoration may chain onto a parent (a scope chains onto the global registry's decoration), in which case the parent is applied outermost: parent.prefix + this.prefix + base. The metric's own values still win over this, which wins over the parent. The version composes both, so a change to either re-registers the metric.