Interface for prometheus (https://prometheus.io/)
More...
#include <Prometheus.hpp>
|
| PrometheusInterface (bool isEnabled, bool compressReply) |
| Construct a new Prometheus Interface object.
|
|
virtual Bool | boolMetric (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0 |
| Get a bool based metric. It will be created if it doesn't exist.
|
|
virtual CounterInt & | counterInt (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0 |
| Get an integer based counter metric. It will be created if it doesn't exist.
|
|
virtual CounterDouble & | counterDouble (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0 |
| Get a double based counter metric. It will be created if it doesn't exist.
|
|
virtual GaugeInt & | gaugeInt (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0 |
| Get an integer based gauge metric. It will be created if it doesn't exist.
|
|
virtual GaugeDouble & | gaugeDouble (std::string name, Labels labels, std::optional< std::string > description=std::nullopt)=0 |
| Get a double based gauge metric. It will be created if it doesn't exist.
|
|
virtual HistogramInt & | histogramInt (std::string name, Labels labels, std::vector< std::int64_t > const &buckets, std::optional< std::string > description=std::nullopt)=0 |
| Get an integer based histogram metric. It will be created if it doesn't exist.
|
|
virtual HistogramDouble & | histogramDouble (std::string name, Labels labels, std::vector< double > const &buckets, std::optional< std::string > description=std::nullopt)=0 |
| Get a double based histogram metric. It will be created if it doesn't exist.
|
|
virtual std::string | collectMetrics ()=0 |
| Collect all metrics and return them as a string in Prometheus format.
|
|
bool | isEnabled () const |
| Whether prometheus is enabled.
|
|
bool | compressReplyEnabled () const |
| Whether to compress the reply.
|
|
Interface for prometheus (https://prometheus.io/)
◆ PrometheusInterface()
util::prometheus::PrometheusInterface::PrometheusInterface |
( |
bool | isEnabled, |
|
|
bool | compressReply ) |
|
inline |
Construct a new Prometheus Interface object.
- Parameters
-
isEnabled | Whether prometheus is enabled |
compressReply | Whether to compress the reply |
◆ boolMetric()
virtual Bool util::prometheus::PrometheusInterface::boolMetric |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get a bool based metric. It will be created if it doesn't exist.
- Note
- Prometheus does not have a native bool type, so we use a counter with a value of 0 or 1
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
description | The description of the metric |
- Returns
- The bool object
Implemented in util::prometheus::PrometheusImpl.
◆ collectMetrics()
virtual std::string util::prometheus::PrometheusInterface::collectMetrics |
( |
| ) |
|
|
pure virtual |
◆ compressReplyEnabled()
bool util::prometheus::PrometheusInterface::compressReplyEnabled |
( |
| ) |
const |
|
inline |
Whether to compress the reply.
- Returns
- true if the reply should be compressed
◆ counterDouble()
virtual CounterDouble & util::prometheus::PrometheusInterface::counterDouble |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get a double based counter metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
description | The description of the metric |
- Returns
- A reference to the counter object
Implemented in util::prometheus::PrometheusImpl.
◆ counterInt()
virtual CounterInt & util::prometheus::PrometheusInterface::counterInt |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get an integer based counter metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
description | The description of the metric |
- Returns
- A reference to the counter object
Implemented in util::prometheus::PrometheusImpl.
◆ gaugeDouble()
virtual GaugeDouble & util::prometheus::PrometheusInterface::gaugeDouble |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get a double based gauge metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
description | The description of the metric |
- Returns
- A reference to the gauge object
Implemented in util::prometheus::PrometheusImpl.
◆ gaugeInt()
virtual GaugeInt & util::prometheus::PrometheusInterface::gaugeInt |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get an integer based gauge metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
description | The description of the metric |
- Returns
- A reference to the gauge object
Implemented in util::prometheus::PrometheusImpl.
◆ histogramDouble()
virtual HistogramDouble & util::prometheus::PrometheusInterface::histogramDouble |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::vector< double > const & | buckets, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get a double based histogram metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
buckets | The buckets of the metric |
description | The description of the metric |
- Returns
- A reference to the histogram object
Implemented in util::prometheus::PrometheusImpl.
◆ histogramInt()
virtual HistogramInt & util::prometheus::PrometheusInterface::histogramInt |
( |
std::string | name, |
|
|
Labels | labels, |
|
|
std::vector< std::int64_t > const & | buckets, |
|
|
std::optional< std::string > | description = std::nullopt ) |
|
pure virtual |
Get an integer based histogram metric. It will be created if it doesn't exist.
- Parameters
-
name | The name of the metric |
labels | The labels of the metric |
buckets | The buckets of the metric |
description | The description of the metric |
- Returns
- A reference to the histogram object
Implemented in util::prometheus::PrometheusImpl.
◆ isEnabled()
bool util::prometheus::PrometheusInterface::isEnabled |
( |
| ) |
const |
|
inline |
Whether prometheus is enabled.
- Returns
- true if prometheus is enabled
The documentation for this class was generated from the following file: