rippled
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 <ripple/beast/insight/NullCollector.h>
21 
22 namespace beast {
23 namespace insight {
24 
25 namespace detail {
26 
27 class NullHookImpl : public HookImpl
28 {
29 public:
30  explicit NullHookImpl() = default;
31 
32 private:
34 };
35 
36 //------------------------------------------------------------------------------
37 
39 {
40 public:
41  explicit NullCounterImpl() = default;
42 
43  void increment (value_type) override
44  {
45  }
46 
47 private:
49 };
50 
51 //------------------------------------------------------------------------------
52 
53 class NullEventImpl : public EventImpl
54 {
55 public:
56  explicit NullEventImpl() = default;
57 
58  void notify (value_type const&) override
59  {
60  }
61 
62 private:
64 };
65 
66 //------------------------------------------------------------------------------
67 
68 class NullGaugeImpl : public GaugeImpl
69 {
70 public:
71  explicit NullGaugeImpl() = default;
72 
73  void set (value_type) override
74  {
75  }
76 
77  void increment (difference_type) override
78  {
79  }
80 
81 private:
83 };
84 
85 //------------------------------------------------------------------------------
86 
87 class NullMeterImpl : public MeterImpl
88 {
89 public:
90  explicit NullMeterImpl() = default;
91 
92  void increment (value_type) override
93  {
94  }
95 
96 private:
98 };
99 
100 //------------------------------------------------------------------------------
101 
103 {
104 private:
105 public:
106  NullCollectorImp() = default;
107 
108  ~NullCollectorImp() = default;
109 
111  {
112  return Hook (std::make_shared <detail::NullHookImpl> ());
113  }
114 
115  Counter make_counter (std::string const&) override
116  {
117  return Counter (std::make_shared <detail::NullCounterImpl> ());
118  }
119 
120  Event make_event (std::string const&) override
121  {
122  return Event (std::make_shared <detail::NullEventImpl> ());
123  }
124 
125  Gauge make_gauge (std::string const&) override
126  {
127  return Gauge (std::make_shared <detail::NullGaugeImpl> ());
128  }
129 
130  Meter make_meter (std::string const&) override
131  {
132  return Meter (std::make_shared <detail::NullMeterImpl> ());
133  }
134 };
135 
136 }
137 
138 //------------------------------------------------------------------------------
139 
141 {
142  return std::make_shared <detail::NullCollectorImp> ();
143 }
144 
145 }
146 }
beast::insight::detail::NullGaugeImpl
Definition: NullCollector.cpp:68
std::string
STL class.
std::shared_ptr< Collector >
beast::insight::Meter
A metric for measuring an integral value.
Definition: Meter.h:37
beast::insight::Counter
A metric for measuring an integral value.
Definition: Counter.h:38
beast::insight::HookImpl
Definition: HookImpl.h:29
beast::insight::CounterImpl
Definition: CounterImpl.h:31
beast::insight::detail::NullGaugeImpl::NullGaugeImpl
NullGaugeImpl()=default
beast::insight::detail::NullMeterImpl::NullMeterImpl
NullMeterImpl()=default
std::chrono::milliseconds
beast::insight::detail::NullHookImpl::operator=
NullHookImpl & operator=(NullHookImpl const &)
beast::insight::detail::NullCollectorImp
Definition: NullCollector.cpp:102
std::function< void(void)>
beast::insight::detail::NullCollectorImp::make_gauge
Gauge make_gauge(std::string const &) override
Create a gauge with the specified name.
Definition: NullCollector.cpp:125
beast::insight::detail::NullEventImpl::operator=
NullEventImpl & operator=(NullEventImpl const &)
beast::insight::MeterImpl
Definition: MeterImpl.h:31
beast::insight::detail::NullMeterImpl::operator=
NullMeterImpl & operator=(NullMeterImpl const &)
beast::insight::detail::NullCollectorImp::make_event
Event make_event(std::string const &) override
Create an event with the specified name.
Definition: NullCollector.cpp:120
beast::insight::detail::NullEventImpl
Definition: NullCollector.cpp:53
beast::insight::NullCollector
A Collector which does not collect metrics.
Definition: NullCollector.h:29
beast::insight::detail::NullHookImpl::NullHookImpl
NullHookImpl()=default
beast::insight::detail::NullCollectorImp::~NullCollectorImp
~NullCollectorImp()=default
beast::insight::detail::NullCollectorImp::make_hook
Hook make_hook(HookImpl::HandlerType const &) override
Definition: NullCollector.cpp:110
beast::insight::detail::NullCounterImpl::NullCounterImpl
NullCounterImpl()=default
beast::insight::Event
A metric for reporting event timing.
Definition: Event.h:42
beast::insight::GaugeImpl
Definition: GaugeImpl.h:31
beast::insight::detail::NullCollectorImp::NullCollectorImp
NullCollectorImp()=default
beast::insight::detail::NullCollectorImp::make_counter
Counter make_counter(std::string const &) override
Create a counter with the specified name.
Definition: NullCollector.cpp:115
beast::insight::detail::NullHookImpl
Definition: NullCollector.cpp:27
std::int64_t
beast::insight::detail::NullGaugeImpl::operator=
NullGaugeImpl & operator=(NullGaugeImpl const &)
beast::insight::Gauge
A metric for measuring an integral value.
Definition: Gauge.h:39
beast::insight::detail::NullCounterImpl
Definition: NullCollector.cpp:38
beast::insight::detail::NullEventImpl::notify
void notify(value_type const &) override
Definition: NullCollector.cpp:58
beast::insight::EventImpl
Definition: EventImpl.h:31
beast::insight::detail::NullCounterImpl::increment
void increment(value_type) override
Definition: NullCollector.cpp:43
beast::insight::detail::NullCounterImpl::operator=
NullCounterImpl & operator=(NullCounterImpl const &)
beast::insight::detail::NullGaugeImpl::increment
void increment(difference_type) override
Definition: NullCollector.cpp:77
beast::insight::detail::NullMeterImpl
Definition: NullCollector.cpp:87
beast::insight::detail::NullGaugeImpl::set
void set(value_type) override
Definition: NullCollector.cpp:73
beast::insight::Hook
A reference to a handler for performing polled collection.
Definition: Hook.h:31
beast::insight::detail::NullEventImpl::NullEventImpl
NullEventImpl()=default
beast::insight::NullCollector::New
static std::shared_ptr< Collector > New()
Definition: NullCollector.cpp:140
beast::insight::detail::NullCollectorImp::make_meter
Meter make_meter(std::string const &) override
Create a meter with the specified name.
Definition: NullCollector.cpp:130
beast::insight::detail::NullMeterImpl::increment
void increment(value_type) override
Definition: NullCollector.cpp:92
beast
Definition: base_uint.h:582