prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
Loading...
Searching...
No Matches
Public Member Functions | List of all members
prom::ScopeState Class Referenceabstract

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...

#include <metric_base.hpp>

Inheritance diagram for prom::ScopeState:
Inheritance graph
[legend]

Public Member Functions

 ScopeState ()=default
 
 ScopeState (const ScopeState &)=delete
 
ScopeStateoperator= (const ScopeState &)=delete
 
 ScopeState (ScopeState &&)=delete
 
ScopeStateoperator= (ScopeState &&)=delete
 
virtual ~ScopeState ()=default
 
virtual std::uint64_t version () const noexcept=0
 Monotonic counter, bumped on every configuration change.
 
virtual std::string full_name (std::string_view base) const =0
 The effective metric name for a base (un-prefixed) name.
 
virtual Labels effective_labels (const Labels &own) const =0
 The effective constant labels for a metric's own labels.
 
virtual comms::DisplayInfo effective_display (const comms::DisplayInfo &own) const =0
 The effective display metadata for a metric's own display.
 
virtual bool decorates () const noexcept=0
 Whether this decoration actually changes anything (a non-empty prefix, constant labels, or display — directly or via a parent it chains onto).
 

Detailed Description

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.

Implemented by prom::Scope. It is declared abstractly here so that metric_base carries no dependency on Scope/Registry (which would be a cycle). version() advances on every configuration change, which is how a scoped metric notices it must re-register.

Constructor & Destructor Documentation

◆ ScopeState() [1/3]

prom::ScopeState::ScopeState ( )
default

◆ ScopeState() [2/3]

prom::ScopeState::ScopeState ( const ScopeState )
delete

◆ ScopeState() [3/3]

prom::ScopeState::ScopeState ( ScopeState &&  )
delete

◆ ~ScopeState()

virtual prom::ScopeState::~ScopeState ( )
virtualdefault

Member Function Documentation

◆ decorates()

virtual bool prom::ScopeState::decorates ( ) const
pure virtualnoexcept

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.

Implemented in prom::detail::DecorationState, and prom::Scope.

◆ effective_display()

virtual comms::DisplayInfo prom::ScopeState::effective_display ( const comms::DisplayInfo &  own) const
pure virtual

The effective display metadata for a metric's own display.

Implemented in prom::detail::DecorationState, and prom::Scope.

◆ effective_labels()

virtual Labels prom::ScopeState::effective_labels ( const Labels own) const
pure virtual

The effective constant labels for a metric's own labels.

Implemented in prom::detail::DecorationState, and prom::Scope.

◆ full_name()

virtual std::string prom::ScopeState::full_name ( std::string_view  base) const
pure virtual

The effective metric name for a base (un-prefixed) name.

Implemented in prom::detail::DecorationState, and prom::Scope.

◆ operator=() [1/2]

ScopeState & prom::ScopeState::operator= ( const ScopeState )
delete

◆ operator=() [2/2]

ScopeState & prom::ScopeState::operator= ( ScopeState &&  )
delete

◆ version()

virtual std::uint64_t prom::ScopeState::version ( ) const
pure virtualnoexcept

Monotonic counter, bumped on every configuration change.

Implemented in prom::detail::DecorationState, and prom::Scope.


The documentation for this class was generated from the following file: