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

The source a metric reads its current adapter from, decoupled from Registry so that metric_base can resolve a binding without depending on the registry layer (which would be an include cycle), mirroring ScopeState. More...

#include <adapter.hpp>

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

Public Member Functions

 AdapterSource ()=default
 
 AdapterSource (const AdapterSource &)=delete
 
AdapterSourceoperator= (const AdapterSource &)=delete
 
 AdapterSource (AdapterSource &&)=delete
 
AdapterSourceoperator= (AdapterSource &&)=delete
 
virtual ~AdapterSource ()=default
 
virtual std::uint64_t version () const noexcept=0
 Monotonic counter, bumped on every adapter swap.
 
virtual AdapterPtr adapter () const =0
 The current adapter, never null.
 

Detailed Description

The source a metric reads its current adapter from, decoupled from Registry so that metric_base can resolve a binding without depending on the registry layer (which would be an include cycle), mirroring ScopeState.

Every MetricCore holds a shared_ptr<AdapterSource> — the AdapterCell of the Registry that created it, or the process-wide global cell for standalone and scoped metrics. version() advances whenever the adapter is swapped, which is how an already-created metric notices it must re-register against the new backend on its next use (live migration).

Constructor & Destructor Documentation

◆ AdapterSource() [1/3]

prom::AdapterSource::AdapterSource ( )
default

◆ AdapterSource() [2/3]

prom::AdapterSource::AdapterSource ( const AdapterSource )
delete

◆ AdapterSource() [3/3]

prom::AdapterSource::AdapterSource ( AdapterSource &&  )
delete

◆ ~AdapterSource()

virtual prom::AdapterSource::~AdapterSource ( )
virtualdefault

Member Function Documentation

◆ adapter()

virtual AdapterPtr prom::AdapterSource::adapter ( ) const
pure virtual

The current adapter, never null.

Returns a shared_ptr copy so a concurrent swap cannot invalidate the adapter an in-flight caller uses.

Implemented in prom::AdapterCell.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ version()

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

Monotonic counter, bumped on every adapter swap.

Implemented in prom::AdapterCell.


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