rippled
Loading...
Searching...
No Matches
Collector.h
1#ifndef BEAST_INSIGHT_COLLECTOR_H_INCLUDED
2#define BEAST_INSIGHT_COLLECTOR_H_INCLUDED
3
4#include <xrpl/beast/insight/Counter.h>
5#include <xrpl/beast/insight/Event.h>
6#include <xrpl/beast/insight/Gauge.h>
7#include <xrpl/beast/insight/Hook.h>
8#include <xrpl/beast/insight/Meter.h>
9
10#include <string>
11
12namespace beast {
13namespace insight {
14
26{
27public:
29
30 virtual ~Collector() = 0;
31
45 template <class Handler>
46 Hook
47 make_hook(Handler handler)
48 {
49 return make_hook(HookImpl::HandlerType(handler));
50 }
51
52 virtual Hook
53 make_hook(HookImpl::HandlerType const& handler) = 0;
60 virtual Counter
61 make_counter(std::string const& name) = 0;
62
64 make_counter(std::string const& prefix, std::string const& name)
65 {
66 if (prefix.empty())
67 return make_counter(name);
68 return make_counter(prefix + "." + name);
69 }
76 virtual Event
77 make_event(std::string const& name) = 0;
78
79 Event
80 make_event(std::string const& prefix, std::string const& name)
81 {
82 if (prefix.empty())
83 return make_event(name);
84 return make_event(prefix + "." + name);
85 }
92 virtual Gauge
93 make_gauge(std::string const& name) = 0;
94
95 Gauge
96 make_gauge(std::string const& prefix, std::string const& name)
97 {
98 if (prefix.empty())
99 return make_gauge(name);
100 return make_gauge(prefix + "." + name);
101 }
108 virtual Meter
109 make_meter(std::string const& name) = 0;
110
111 Meter
112 make_meter(std::string const& prefix, std::string const& name)
113 {
114 if (prefix.empty())
115 return make_meter(name);
116 return make_meter(prefix + "." + name);
117 }
119};
120
121} // namespace insight
122} // namespace beast
123
124#endif
Interface for a manager that allows collection of metrics.
Definition Collector.h:26
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:112
Counter make_counter(std::string const &prefix, std::string const &name)
Definition Collector.h:64
virtual Hook make_hook(HookImpl::HandlerType const &handler)=0
Gauge make_gauge(std::string const &prefix, std::string const &name)
Definition Collector.h:96
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:80
Hook make_hook(Handler handler)
Create a hook.
Definition Collector.h:47
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:20
A metric for reporting event timing.
Definition Event.h:22
A metric for measuring an integral value.
Definition Gauge.h:21
A reference to a handler for performing polled collection.
Definition Hook.h:13
A metric for measuring an integral value.
Definition Meter.h:19
T empty(T... args)