xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
beast
insight
Collector.h
1
#pragma once
2
3
#include <xrpl/beast/insight/Counter.h>
4
#include <xrpl/beast/insight/Event.h>
5
#include <xrpl/beast/insight/Gauge.h>
6
#include <xrpl/beast/insight/Hook.h>
7
#include <xrpl/beast/insight/HookImpl.h>
8
#include <xrpl/beast/insight/Meter.h>
9
10
#include <
memory
>
11
#include <
string
>
12
13
namespace
beast::insight
{
14
26
class
Collector
27
{
28
public
:
29
using
Ptr
=
std::shared_ptr<Collector>
;
30
31
virtual
~Collector
() = 0;
32
47
template
<
class
Handler>
48
Hook
49
makeHook
(Handler handler)
50
{
51
return
makeHook
(
HookImpl::HandlerType
(handler));
52
}
53
54
virtual
Hook
55
makeHook
(
HookImpl::HandlerType
const
& handler) = 0;
57
63
virtual
Counter
64
makeCounter
(
std::string
const
& name) = 0;
65
66
Counter
67
makeCounter
(
std::string
const
& prefix,
std::string
const
& name)
68
{
69
if
(prefix.
empty
())
70
return
makeCounter
(name);
71
return
makeCounter
(prefix +
"."
+ name);
72
}
73
74
80
virtual
Event
81
makeEvent
(
std::string
const
& name) = 0;
82
83
Event
84
makeEvent
(
std::string
const
& prefix,
std::string
const
& name)
85
{
86
if
(prefix.
empty
())
87
return
makeEvent
(name);
88
return
makeEvent
(prefix +
"."
+ name);
89
}
90
91
97
virtual
Gauge
98
makeGauge
(
std::string
const
& name) = 0;
99
100
Gauge
101
makeGauge
(
std::string
const
& prefix,
std::string
const
& name)
102
{
103
if
(prefix.
empty
())
104
return
makeGauge
(name);
105
return
makeGauge
(prefix +
"."
+ name);
106
}
107
108
114
virtual
Meter
115
makeMeter
(
std::string
const
& name) = 0;
116
117
Meter
118
makeMeter
(
std::string
const
& prefix,
std::string
const
& name)
119
{
120
if
(prefix.
empty
())
121
return
makeMeter
(name);
122
return
makeMeter
(prefix +
"."
+ name);
123
}
124
125
};
126
127
}
// namespace beast::insight
std::string
beast::insight::Collector
Interface for a manager that allows collection of metrics.
Definition
Collector.h:27
beast::insight::Collector::makeEvent
virtual Event makeEvent(std::string const &name)=0
Create an event with the specified name.
beast::insight::Collector::makeCounter
virtual Counter makeCounter(std::string const &name)=0
Create a counter with the specified name.
beast::insight::Collector::makeEvent
Event makeEvent(std::string const &prefix, std::string const &name)
Definition
Collector.h:84
beast::insight::Collector::~Collector
virtual ~Collector()=0
beast::insight::Collector::makeMeter
virtual Meter makeMeter(std::string const &name)=0
Create a meter with the specified name.
beast::insight::Collector::makeHook
Hook makeHook(Handler handler)
Create a hook.
Definition
Collector.h:49
beast::insight::Collector::makeGauge
Gauge makeGauge(std::string const &prefix, std::string const &name)
Definition
Collector.h:101
beast::insight::Collector::makeHook
virtual Hook makeHook(HookImpl::HandlerType const &handler)=0
beast::insight::Collector::Ptr
std::shared_ptr< Collector > Ptr
Definition
Collector.h:29
beast::insight::Collector::makeCounter
Counter makeCounter(std::string const &prefix, std::string const &name)
Definition
Collector.h:67
beast::insight::Collector::makeMeter
Meter makeMeter(std::string const &prefix, std::string const &name)
Definition
Collector.h:118
beast::insight::Collector::makeGauge
virtual Gauge makeGauge(std::string const &name)=0
Create a gauge with the specified name.
beast::insight::Counter
A metric for measuring an integral value.
Definition
Counter.h:20
beast::insight::Event
A metric for reporting event timing.
Definition
Event.h:22
beast::insight::Gauge
A metric for measuring an integral value.
Definition
Gauge.h:21
beast::insight::HookImpl::HandlerType
std::function< void(void)> HandlerType
Definition
HookImpl.h:11
beast::insight::Hook
A reference to a handler for performing polled collection.
Definition
Hook.h:14
beast::insight::Meter
A metric for measuring an integral value.
Definition
Meter.h:19
std::string::empty
T empty(T... args)
memory
beast::insight
Definition
Collector.h:13
std::shared_ptr
string
Generated by
1.17.0