Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::prometheus Namespace Reference

Prometheus metrics: counters, gauges, histograms and their registry and serialization. More...

Classes

class  AnyBool
 A wrapped to provide bool interface for a Prometheus metric. More...
struct  AnyCounter
 A prometheus counter metric implementation. It can only be increased or be reset to zero. More...
struct  AnyGauge
 A prometheus gauge metric implementation. It can be increased, decreased or set to a value. More...
class  AnyHistogram
 A Prometheus histogram metric with a generic value type. More...
class  Label
 Class representing a Prometheus label. More...
class  Labels
 Class representing a collection of Prometheus labels. More...
class  MetricBase
 Base class for a Prometheus metric containing a name and labels. More...
class  MetricBuilder
 Implementation for building a metric. More...
struct  MetricBuilderInterface
 Interface to create a metric. More...
class  MetricsFamily
 Class representing a collection of Prometheus metric with the same name and type. More...
class  OStream
 A stream that can optionally compress its data. More...
class  PrometheusImpl
 Implementation of PrometheusInterface. More...
class  PrometheusInterface
 Interface for prometheus (https://prometheus.io/). More...

Concepts

concept  SomeBoolImpl
 Specifies an integer metric implementation that can back AnyBool (e.g. GaugeInt).

Typedefs

using Bool = AnyBool<GaugeInt>
 Alias for Prometheus bool metric with GaugeInt implementation.
using CounterInt = AnyCounter<std::uint64_t>
 A prometheus counter metric implementation with a value of type std::int64_t.
using CounterDouble = AnyCounter<double>
 A prometheus counter metric implementation with a value of type double.
using GaugeInt = AnyGauge<std::int64_t>
 Alias for a gauge with a 64-bit integer value.
using GaugeDouble = AnyGauge<double>
 Alias for a gauge with a double value.
using HistogramInt = AnyHistogram<std::int64_t>
 Histogram of integer values.
using HistogramDouble = AnyHistogram<double>
 Histogram of floating point values.

Enumerations

enum class  MetricType {
  CounterInt , CounterDouble , GaugeInt , GaugeDouble ,
  HistogramInt , HistogramDouble , Summary
}
 The kind and value type of a Prometheus metric. More...

Functions

std::optional< http::response< http::string_body > > handlePrometheusRequest (boost::beast::http::request< boost::beast::http::string_body > const &req, bool isAdmin)
 Handles a prometheus request.
OStream & operator<< (OStream &stream, MetricBase const &metricBase)
char const * toString (MetricType type)
 Get the Prometheus type name of a metric type, as used in the # TYPE line.
OStream & operator<< (OStream &stream, MetricsFamily const &metricsFamily)

Detailed Description

Prometheus metrics: counters, gauges, histograms and their registry and serialization.

Enumeration Type Documentation

◆ MetricType

enum class util::prometheus::MetricType
strong

The kind and value type of a Prometheus metric.

Enumerator
CounterInt 

Counter with integer values.

CounterDouble 

Counter with floating point values.

GaugeInt 

Gauge with integer values.

GaugeDouble 

Gauge with floating point values.

HistogramInt 

Histogram with integer values.

HistogramDouble 

Histogram with floating point values.

Summary 

Summary (not currently supported by the metric builder).

Function Documentation

◆ handlePrometheusRequest()

std::optional< boost::beast::http::response< boost::beast::http::string_body > > util::prometheus::handlePrometheusRequest ( boost::beast::http::request< boost::beast::http::string_body > const & req,
bool isAdmin )

Handles a prometheus request.

Parameters
reqThe http request from primetheus (required only to reply with the same http version)
isAdminWhether the request is from an admin
Returns
nullopt if the request shouldn't be handled, respoce for Prometheus otherwise

◆ operator<<() [1/2]

OStream & util::prometheus::operator<< ( OStream & stream,
MetricBase const & metricBase )
Parameters
streamThe stream to serialize into
metricBaseThe metric to serialize
Returns
The stream, for chaining

◆ operator<<() [2/2]

OStream & util::prometheus::operator<< ( OStream & stream,
MetricsFamily const & metricsFamily )
Parameters
streamThe stream to serialize into
metricsFamilyThe metrics to serialize
Returns
The stream, for chaining

◆ toString()

char const * util::prometheus::toString ( MetricType type)

Get the Prometheus type name of a metric type, as used in the # TYPE line.

Parameters
typeThe metric type
Returns
"counter", "gauge", "histogram" or "summary"