18 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0};
36 use_default_buckets();
46 if (
core_->buckets.empty()) {
47 use_default_buckets();
50 core_->has_unit =
true;
62 requires std::is_arithmetic_v<T>
68 template <DimensionalValue V>
78 void use_default_buckets()
const {
82 void record(
const NormalizedValue& nv)
const noexcept {
83 const auto [adapter, handle] = this->
bind();
90 adapter->observe(handle, nv.value);
A histogram.
Definition histogram.hpp:32
void observe(T value) noexcept
Observe a raw value.
Definition histogram.hpp:63
Histogram(const HistogramSpec &spec)
Definition histogram.hpp:39
Histogram(const std::string_view name, const std::string_view help)
Definition histogram.hpp:34
void observe(const V &value) noexcept
Observe a dimensional value.
Definition histogram.hpp:69
Histogram labels(const Labels &dynamic) const noexcept
Definition histogram.hpp:73
Histogram(std::shared_ptr< MetricCore > core)
Definition histogram.hpp:58
An immutable-by-convention set of labels, kept sorted by name with duplicates collapsed last-wins.
Definition labels.hpp:55
CRTP base shared by every metric type.
Definition metric_base.hpp:377
Histogram make_child(const Labels &dynamic) const noexcept
Resolve a labeled child of the same metric type.
Definition metric_base.hpp:458
bool reconcile_unit(const Unit &observed, Adapter &adapter) const noexcept
Reconcile an observed unit against the family's known unit.
Definition metric_base.hpp:475
std::string_view name() const noexcept
The metric's fully-qualified name.
Definition metric_base.hpp:380
const std::shared_ptr< MetricCore > & core() const noexcept
Definition metric_base.hpp:449
bool check_finite(const double value, std::string_view op) const noexcept
Drop-and-log guard for a non-finite sample.
Definition metric_base.hpp:514
std::shared_ptr< MetricCore > core_
Definition metric_base.hpp:530
Binding bind() const noexcept
Resolve the adapter and backend handle this metric should record against.
Definition metric_base.hpp:435
MetricCore (the shared per-series state) and the CRTP MetricBase that gives every metric type value s...
Definition adapter.hpp:24
NormalizedValue normalize(const V &value)
Reduce a dimval value to a NormalizedValue.
Definition dimval.hpp:47
MetricType
The OpenMetrics / Prometheus metric kinds prom understands.
Definition unit.hpp:15
constexpr std::array< double, 11 > default_histogram_buckets
The default bucket bounds applied when a histogram spec leaves buckets empty — the canonical Promethe...
Definition histogram.hpp:17
Declarative description of a histogram.
Definition histogram.hpp:21
std::string_view help
Definition histogram.hpp:23
std::string_view name
Definition histogram.hpp:22
Labels labels
Definition histogram.hpp:24
std::vector< double > buckets
Upper bounds; default set used when empty.
Definition histogram.hpp:27
Unit unit
Definition histogram.hpp:25
comms::DisplayInfo display
Definition histogram.hpp:26
OpenMetrics unit suffix plus optional dimensional metadata.
Definition unit.hpp:53
std::string_view kind
Dimensional compatibility group (e.g. "time").
Definition unit.hpp:55
bool from_dimval
True when inferred from a dimval value.
Definition unit.hpp:57
std::string_view name
Human-readable unit name (e.g. "seconds").
Definition unit.hpp:54
constexpr bool empty() const noexcept
A unit carries no information when it has neither a name nor a kind.
Definition unit.hpp:60
std::string_view symbol
Display symbol (e.g. "s").
Definition unit.hpp:56