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/NullCollector.h>
21
22namespace beast {
23namespace insight {
24
25namespace detail {
26
27class NullHookImpl : public HookImpl
28{
29public:
30 explicit NullHookImpl() = default;
31
32private:
35};
36
37//------------------------------------------------------------------------------
38
40{
41public:
42 explicit NullCounterImpl() = default;
43
44 void
46 {
47 }
48
49private:
52};
53
54//------------------------------------------------------------------------------
55
57{
58public:
59 explicit NullEventImpl() = default;
60
61 void
62 notify(value_type const&) override
63 {
64 }
65
66private:
69};
70
71//------------------------------------------------------------------------------
72
74{
75public:
76 explicit NullGaugeImpl() = default;
77
78 void
79 set(value_type) override
80 {
81 }
82
83 void
85 {
86 }
87
88private:
91};
92
93//------------------------------------------------------------------------------
94
96{
97public:
98 explicit NullMeterImpl() = default;
99
100 void
102 {
103 }
104
105private:
108};
109
110//------------------------------------------------------------------------------
111
113{
114private:
115public:
116 NullCollectorImp() = default;
117
118 ~NullCollectorImp() = default;
119
120 Hook
122 {
123 return Hook(std::make_shared<detail::NullHookImpl>());
124 }
125
126 Counter
127 make_counter(std::string const&) override
128 {
129 return Counter(std::make_shared<detail::NullCounterImpl>());
130 }
131
132 Event
133 make_event(std::string const&) override
134 {
135 return Event(std::make_shared<detail::NullEventImpl>());
136 }
137
138 Gauge
139 make_gauge(std::string const&) override
140 {
141 return Gauge(std::make_shared<detail::NullGaugeImpl>());
142 }
143
144 Meter
145 make_meter(std::string const&) override
146 {
147 return Meter(std::make_shared<detail::NullMeterImpl>());
148 }
149};
150
151} // namespace detail
152
153//------------------------------------------------------------------------------
154
157{
158 return std::make_shared<detail::NullCollectorImp>();
159}
160
161} // namespace insight
162} // 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 &)