3#include "util/prometheus/OStream.hpp"
45 [[nodiscard]] std::string
const&
52 [[nodiscard]] std::string
const&
66 std::string labelsString_;
friend OStream & operator<<(OStream &stream, MetricBase const &metricBase)
Serialize the metric to a string in Prometheus format.
Definition MetricBase.cpp:17
MetricBase(std::string name, std::string labelsString)
Construct a new MetricBase object.
Definition MetricBase.cpp:11
std::string const & name() const
Get the name of the metric.
Definition MetricBase.cpp:48
virtual void serializeValue(OStream &stream) const =0
Interface to serialize the value of the metric.
std::string const & labelsString() const
Get the labels of the metric in serialized format, e.g. {name="value",name2="value2"}...
Definition MetricBase.cpp:54
A stream that can optionally compress its data.
Definition OStream.hpp:12
Prometheus metrics: counters, gauges, histograms and their registry and serialization.
Definition Bool.hpp:12
AnyCounter< std::uint64_t > CounterInt
A prometheus counter metric implementation with a value of type std::int64_t.
Definition Counter.hpp:114
char const * toString(MetricType type)
Get the Prometheus type name of a metric type, as used in the # TYPE line.
Definition MetricBase.cpp:24
AnyCounter< double > CounterDouble
A prometheus counter metric implementation with a value of type double.
Definition Counter.hpp:119
AnyGauge< std::int64_t > GaugeInt
Alias for a gauge with a 64-bit integer value.
Definition Gauge.hpp:127
MetricType
The kind and value type of a Prometheus metric.
Definition MetricBase.hpp:72
@ Summary
Summary (not currently supported by the metric builder).
Definition MetricBase.hpp:79
AnyHistogram< double > HistogramDouble
Histogram of floating point values.
Definition Histogram.hpp:135
AnyGauge< double > GaugeDouble
Alias for a gauge with a double value.
Definition Gauge.hpp:132
AnyHistogram< std::int64_t > HistogramInt
Histogram of integer values.
Definition Histogram.hpp:134