Metrics#

Writer#

class Writer#

Writer (Prometheus’ exposition format)

Public Functions

virtual Writer &write_type(std::string_view const &name, std::string_view const &type) = 0#

Write the TYPE header.

virtual Writer &write_simple(std::string_view const &name, std::string_view const &labels, uint64_t value) = 0#

Write simple metrics (counter and gauge)

virtual Writer &write_bucket(std::string_view const &name, std::string_view const &labels, double quantile, uint64_t value) = 0#

Write histogram buckets.

virtual Writer &write_sum(std::string_view const &name, std::string_view const &labels, double value) = 0#

Write histogram sum.

virtual Writer &write_count(std::string_view const &name, std::string_view const &labels, uint64_t count) = 0#

Write histogram count.

virtual Writer &finish() = 0#

Finish this metric.

template<typename T>
inline Writer &write(const T &collector, std::string_view const &name)#

Dispatch helper.

Counter#

template<typename T>
class Counter#

Counter.

Public Functions

inline Counter &operator++()#

Increment counter.

inline Counter &operator+=(uint64_t value)#

Increment counter by value.

inline void update(uint64_t value) noexcept#

Update counter to specific value.

inline void write(Writer &writer, std::string_view const &name) const#

Write formatted output.

inline void write(Writer &writer, std::string_view const &name, std::string_view const &labels) const#

Write formatted output.

Gauge#

template<typename T>
class Gauge#

Gauge.

Public Functions

inline void set(T value)#

Set gauge to specific value.

inline void write(Writer &writer, std::string_view const &name) const#

Write formatted output.

inline void write(Writer &writer, std::string_view const &name, std::string_view const &labels) const#

Write formatted output.

Histogram#

template<uint64_t N0, uint64_t N1, uint64_t N2, uint64_t N3, uint64_t N4, uint64_t N5>
struct Histogram : public roq::metrics::Base#

Histogram.

Public Functions

inline void prefetch() noexcept#

Prefetch data into L1 cache.

inline bool update(uint64_t value) noexcept#

Update histogram with specific value.

inline Writer &write(Writer &writer, std::string_view const &name) const#

Write formatted output.

inline Writer &write(Writer &writer, std::string_view const &name, std::string_view const &labels) const#

Write formatted output.