Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
MetricBuilder.hpp
1
#pragma once
2
3
#include "util/prometheus/MetricBase.hpp"
4
5
#include <cstdint>
6
#include <memory>
7
#include <string>
8
#include <vector>
9
10
namespace
util::prometheus {
11
15
struct
MetricBuilderInterface
{
16
virtual
~MetricBuilderInterface
() =
default
;
17
28
virtual
std::unique_ptr<MetricBase>
29
operator()
(
30
std::string name,
31
std::string labelsString,
32
MetricType type,
33
std::vector<std::int64_t>
const
& buckets = {}
34
) = 0;
35
46
virtual
std::unique_ptr<MetricBase>
47
operator()
(
48
std::string name,
49
std::string labelsString,
50
MetricType type,
51
std::vector<double>
const
& buckets
52
) = 0;
53
};
54
58
class
MetricBuilder
:
public
MetricBuilderInterface
{
59
public
:
60
std::unique_ptr<MetricBase>
61
operator()
(
62
std::string name,
63
std::string labelsString,
64
MetricType type,
65
std::vector<std::int64_t>
const
& buckets = {}
66
)
override
;
67
68
std::unique_ptr<MetricBase>
69
operator()
(
70
std::string name,
71
std::string labelsString,
72
MetricType type,
73
std::vector<double>
const
& buckets
74
)
override
;
75
76
private
:
77
static
std::unique_ptr<MetricBase>
78
makeMetric(std::string name, std::string labelsString, MetricType type);
79
80
template
<
typename
ValueType>
81
requires
std::same_as<ValueType, std::int64_t> || std::same_as<ValueType, double>
82
std::unique_ptr<MetricBase>
83
makeHistogram(
84
std::string name,
85
std::string labelsString,
86
MetricType type,
87
std::vector<ValueType>
const
& buckets
88
);
89
};
90
91
}
// namespace util::prometheus
util::prometheus::MetricBuilder
Implementation for building a metric.
Definition
MetricBuilder.hpp:58
util::prometheus::MetricBuilder::operator()
std::unique_ptr< MetricBase > operator()(std::string name, std::string labelsString, MetricType type, std::vector< std::int64_t > const &buckets={}) override
Create a metric.
Definition
MetricBuilder.cpp:19
util::prometheus::MetricBuilderInterface
Interface to create a metric.
Definition
MetricBuilder.hpp:15
util::prometheus::MetricBuilderInterface::operator()
virtual std::unique_ptr< MetricBase > operator()(std::string name, std::string labelsString, MetricType type, std::vector< double > const &buckets)=0
Create a metric double based histogram.
util::prometheus::MetricBuilderInterface::operator()
virtual std::unique_ptr< MetricBase > operator()(std::string name, std::string labelsString, MetricType type, std::vector< std::int64_t > const &buckets={})=0
Create a metric.
src
util
prometheus
MetricBuilder.hpp
Generated by
1.17.0