prom 0.1.0
Client-independent C++23 Prometheus/OpenMetrics metric abstraction
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
prom::Unit Struct Reference

OpenMetrics unit suffix plus optional dimensional metadata. More...

#include <unit.hpp>

Collaboration diagram for prom::Unit:
Collaboration graph
[legend]

Public Member Functions

constexpr bool empty () const noexcept
 A unit carries no information when it has neither a name nor a kind.
 
bool operator== (const Unit &) const =default
 

Public Attributes

std::string_view name {}
 Human-readable unit name (e.g. "seconds").
 
std::string_view kind {}
 Dimensional compatibility group (e.g. "time").
 
std::string_view symbol {}
 Display symbol (e.g. "s").
 
bool from_dimval = false
 True when inferred from a dimval value.
 

Detailed Description

OpenMetrics unit suffix plus optional dimensional metadata.

All string fields are std::string_view so that the built-in dimval descriptors — which return string_view literals — stay zero-copy. When a Unit is handed to an Adapter (via MetricMeta or Adapter::set_unit) the views must stay valid only for the duration of that call; backends copy what they need synchronously.

Member Function Documentation

◆ empty()

constexpr bool prom::Unit::empty ( ) const
inlineconstexprnoexcept

A unit carries no information when it has neither a name nor a kind.

◆ operator==()

bool prom::Unit::operator== ( const Unit ) const
default

Member Data Documentation

◆ from_dimval

bool prom::Unit::from_dimval = false

True when inferred from a dimval value.

◆ kind

std::string_view prom::Unit::kind {}

Dimensional compatibility group (e.g. "time").

◆ name

std::string_view prom::Unit::name {}

Human-readable unit name (e.g. "seconds").

◆ symbol

std::string_view prom::Unit::symbol {}

Display symbol (e.g. "s").


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