prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
Loading...
Searching...
No Matches
Classes | Functions
prom::detail Namespace Reference

Portable atomic shared_ptr<const T> exposing just load()/store(). More...

Classes

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

Functions

comms::DisplayInfo 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 display_empty (const comms::DisplayInfo &display) noexcept
 Whether a DisplayInfo carries any field at all.
 
std::shared_ptr< DecorationStateglobal_decoration ()
 The process-wide decoration shared by Registry::global(), every standalone metric, and (as their chain parent) every Scope.
 

Detailed Description

Portable atomic shared_ptr<const T> exposing just load()/store().

Uses std::atomic<std::shared_ptr<...>> on toolchains that implement it (__cpp_lib_atomic_shared_ptr); otherwise falls back to a mutex-guarded shared_ptr. Apple's libc++ (as of Xcode 26) ships C++23 without the atomic shared_ptr specialization, so the fallback is the live path there.

Function Documentation

◆ display_empty()

bool prom::detail::display_empty ( const comms::DisplayInfo &  display)
inlinenoexcept

Whether a DisplayInfo carries any field at all.

◆ global_decoration()

std::shared_ptr< DecorationState > prom::detail::global_decoration ( )
inline

The process-wide decoration shared by Registry::global(), every standalone metric, and (as their chain parent) every Scope.

Installing a prefix or constant labels here — e.g. via Registry::global()->set_prefix(...) — therefore reaches every metric in the process on its next use. Empty by default, so it is a no-op until configured.

◆ merge_display()

comms::DisplayInfo prom::detail::merge_display ( const comms::DisplayInfo &  base,
const comms::DisplayInfo &  over 
)
inline

Overlay a metric's own display fields onto a set of defaults; each per-metric field that is set wins over the default.

Shared by every ScopeState.