Metrics

Writer

class roq::metrics::Writer

Writer (Prometheus’ exposition format)

Public Functions

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

Write the TYPE header.

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

Write simple metrics (counter and gauge)

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

Write histogram buckets.

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

Write histogram sum.

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

Write histogram count.

Writer &finish() = 0

Finish this metric.

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

Dispatch helper.

Counter

template<typename T>
class roq::metrics::Counter

Counter.

Public Functions

Counter &operator++()

Increment counter.

void update(uint64_t value) noexcept

Update counter to specific value.

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

Write formatted output.

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

Write formatted output.

Gauge

template<typename T>
class roq::metrics::Gauge

Gauge.

Public Functions

void set(T value)

Set gauge to specific value.

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

Write formatted output.

void write(Writer &writer, const std::string_view &name, const std::string_view &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 roq::metrics::Histogram : public roq::metrics::Base

Histogram.

Public Functions

void prefetch() noexcept

Prefetch data into L1 cache.

bool update(uint64_t value) noexcept

Update histogram with specific value.

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

Write formatted output.

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

Write formatted output.