rippled
Loading...
Searching...
No Matches
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/Meter.h>
8
9#include <string>
10
11namespace beast {
12namespace insight {
13
25{
26public:
28
29 virtual ~Collector() = 0;
30
44 template <class Handler>
45 Hook
46 make_hook(Handler handler)
47 {
48 return make_hook(HookImpl::HandlerType(handler));
49 }
50
51 virtual Hook
52 make_hook(HookImpl::HandlerType const& handler) = 0;
59 virtual Counter
60 make_counter(std::string const& name) = 0;
61
63 make_counter(std::string const& prefix, std::string const& name)
64 {
65 if (prefix.empty())
66 return make_counter(name);
67 return make_counter(prefix + "." + name);
68 }
75 virtual Event
76 make_event(std::string const& name) = 0;
77
78 Event
79 make_event(std::string const& prefix, std::string const& name)
80 {
81 if (prefix.empty())
82 return make_event(name);
83 return make_event(prefix + "." + name);
84 }
91 virtual Gauge
92 make_gauge(std::string const& name) = 0;
93
94 Gauge
95 make_gauge(std::string const& prefix, std::string const& name)
96 {
97 if (prefix.empty())
98 return make_gauge(name);
99 return make_gauge(prefix + "." + name);
100 }
107 virtual Meter
108 make_meter(std::string const& name) = 0;
109
110 Meter
111 make_meter(std::string const& prefix, std::string const& name)
112 {
113 if (prefix.empty())
114 return make_meter(name);
115 return make_meter(prefix + "." + name);
116 }
118};
119
120} // namespace insight
121} // namespace beast
Interface for a manager that allows collection of metrics.
Definition Collector.h:25
virtual Gauge make_gauge(std::string const &name)=0
Create a gauge with the specified name.
Meter make_meter(std::string const &prefix, std::string const &name)
Definition Collector.h:111
Counter make_counter(std::string const &prefix, std::string const &name)
Definition Collector.h:63
virtual Hook make_hook(HookImpl::HandlerType const &handler)=0
Gauge make_gauge(std::string const &prefix, std::string const &name)
Definition Collector.h:95
virtual Counter make_counter(std::string const &name)=0
Create a counter with the specified name.
virtual Event make_event(std::string const &name)=0
Create an event with the specified name.
Event make_event(std::string const &prefix, std::string const &name)
Definition Collector.h:79
Hook make_hook(Handler handler)
Create a hook.
Definition Collector.h:46
virtual Meter make_meter(std::string const &name)=0
Create a meter with the specified name.
A metric for measuring an integral value.
Definition Counter.h:19
A metric for reporting event timing.
Definition Event.h:21
A metric for measuring an integral value.
Definition Gauge.h:20
A reference to a handler for performing polled collection.
Definition Hook.h:12
A metric for measuring an integral value.
Definition Meter.h:18
T empty(T... args)