rippled
Loading...
Searching...
No Matches
NullCollector.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of Beast: https://github.com/vinniefalco/Beast
4 Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <xrpl/beast/insight/Collector.h>
21#include <xrpl/beast/insight/Counter.h>
22#include <xrpl/beast/insight/CounterImpl.h>
23#include <xrpl/beast/insight/Event.h>
24#include <xrpl/beast/insight/EventImpl.h>
25#include <xrpl/beast/insight/Gauge.h>
26#include <xrpl/beast/insight/GaugeImpl.h>
27#include <xrpl/beast/insight/Hook.h>
28#include <xrpl/beast/insight/HookImpl.h>
29#include <xrpl/beast/insight/Meter.h>
30#include <xrpl/beast/insight/MeterImpl.h>
31#include <xrpl/beast/insight/NullCollector.h>
32
33#include <memory>
34#include <string>
35
36namespace beast {
37namespace insight {
38
39namespace detail {
40
41class NullHookImpl : public HookImpl
42{
43public:
44 explicit NullHookImpl() = default;
45
46private:
49};
50
51//------------------------------------------------------------------------------
52
54{
55public:
56 explicit NullCounterImpl() = default;
57
58 void
60 {
61 }
62
63private:
66};
67
68//------------------------------------------------------------------------------
69
71{
72public:
73 explicit NullEventImpl() = default;
74
75 void
76 notify(value_type const&) override
77 {
78 }
79
80private:
83};
84
85//------------------------------------------------------------------------------
86
88{
89public:
90 explicit NullGaugeImpl() = default;
91
92 void
93 set(value_type) override
94 {
95 }
96
97 void
99 {
100 }
101
102private:
105};
106
107//------------------------------------------------------------------------------
108
110{
111public:
112 explicit NullMeterImpl() = default;
113
114 void
116 {
117 }
118
119private:
122};
123
124//------------------------------------------------------------------------------
125
127{
128private:
129public:
130 NullCollectorImp() = default;
131
132 ~NullCollectorImp() = default;
133
134 Hook
136 {
137 return Hook(std::make_shared<detail::NullHookImpl>());
138 }
139
140 Counter
141 make_counter(std::string const&) override
142 {
143 return Counter(std::make_shared<detail::NullCounterImpl>());
144 }
145
146 Event
147 make_event(std::string const&) override
148 {
149 return Event(std::make_shared<detail::NullEventImpl>());
150 }
151
152 Gauge
153 make_gauge(std::string const&) override
154 {
155 return Gauge(std::make_shared<detail::NullGaugeImpl>());
156 }
157
158 Meter
159 make_meter(std::string const&) override
160 {
161 return Meter(std::make_shared<detail::NullMeterImpl>());
162 }
163};
164
165} // namespace detail
166
167//------------------------------------------------------------------------------
168
171{
172 return std::make_shared<detail::NullCollectorImp>();
173}
174
175} // namespace insight
176} // namespace beast
A metric for measuring an integral value.
Definition: Counter.h:39
A metric for reporting event timing.
Definition: Event.h:41
A metric for measuring an integral value.
Definition: Gauge.h:40
A reference to a handler for performing polled collection.
Definition: Hook.h:32
A metric for measuring an integral value.
Definition: Meter.h:38
A Collector which does not collect metrics.
Definition: NullCollector.h:30
static std::shared_ptr< Collector > New()
Event make_event(std::string const &) override
Create an event with the specified name.
Meter make_meter(std::string const &) override
Create a meter with the specified name.
Hook make_hook(HookImpl::HandlerType const &) override
Gauge make_gauge(std::string const &) override
Create a gauge with the specified name.
Counter make_counter(std::string const &) override
Create a counter with the specified name.
NullCounterImpl & operator=(NullCounterImpl const &)
void increment(value_type) override
void notify(value_type const &) override
NullEventImpl & operator=(NullEventImpl const &)
void increment(difference_type) override
NullGaugeImpl & operator=(NullGaugeImpl const &)
NullHookImpl & operator=(NullHookImpl const &)
void increment(value_type) override
NullMeterImpl & operator=(NullMeterImpl const &)