File tree Expand file tree Collapse file tree 4 files changed +78
-0
lines changed
Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ set(TEST_SRCS
145145 test /testProcessDetails.cxx
146146 test /testProcessMonitor.cxx
147147 test /testInfluxDb.cxx
148+ test /testNoop.cxx
148149 )
149150if (APMON_FOUND)
150151 list (APPEND TEST_SRCS test /testApMon.cxx)
Original file line number Diff line number Diff line change 1+ // /
2+ // / \file Noop.h
3+ // / \author Adam Wegrzynek <[email protected] >4+ // /
5+
6+ #ifndef ALICEO2_MONITORING_BACKENDS_NOOP_H
7+ #define ALICEO2_MONITORING_BACKENDS_NOOP_H
8+
9+ #include " Monitoring/Backend.h"
10+
11+ namespace o2
12+ {
13+ // / ALICE O2 Monitoring system
14+ namespace monitoring
15+ {
16+ // / Monitoring backends
17+ namespace backends
18+ {
19+
20+ // / \brief No-op backend
21+ // /
22+ // / \author Adam Wegrzynek <[email protected] >23+ class Noop final : public Backend
24+ {
25+ public:
26+ // / Constructs backend
27+ Noop () = default ;
28+
29+ // / Default destructor
30+ ~Noop () = default ;
31+
32+ // / \@param metrics vector of metrics
33+ void send (std::vector<Metric>&& /* metrics*/ ) final {}
34+
35+ // / \param metric reference to metric object:
36+ void send (const Metric& /* metric*/ ) final {}
37+
38+ // / \param measurement measurement name
39+ // / \param metrics list of metrics
40+ void sendMultiple (std::string /* measurement*/ , std::vector<Metric>&& /* metrics*/ ) final {}
41+
42+ // / \param name tag name
43+ // / \param value tag value that is concatenated to entity string
44+ void addGlobalTag (std::string /* name*/ , std::string /* value*/ ) final {}
45+ };
46+
47+ } // namespace backends
48+ } // namespace monitoring
49+ } // namespace o2
50+
51+ #endif // ALICEO2_MONITORING_BACKENDS_NOOP_H
Original file line number Diff line number Diff line change 1212
1313#include " Backends/InfoLoggerBackend.h"
1414#include " Backends/Flume.h"
15+ #include " Backends/Noop.h"
1516
1617#ifdef _WITH_APPMON
1718#include " Backends/ApMonBackend.h"
@@ -55,6 +56,10 @@ std::unique_ptr<Backend> getApMon(http::url /*uri*/) {
5556}
5657#endif
5758
59+ std::unique_ptr<Backend> getNoop (http::url /* uri*/ ) {
60+ return std::make_unique<backends::Noop>();
61+ }
62+
5863std::unique_ptr<Backend> getFlume (http::url uri) {
5964 return std::make_unique<backends::Flume>(uri.host , uri.port );
6065}
@@ -66,6 +71,7 @@ std::unique_ptr<Backend> MonitoringFactory::GetBackend(std::string& url) {
6671 {" influxdb-http" , getInfluxDb},
6772 {" apmon" , getApMon},
6873 {" flume" , getFlume},
74+ {" no-op" , getNoop}
6975 };
7076
7177 http::url parsedUrl = http::ParseHttpUrl (url);
Original file line number Diff line number Diff line change 1+ #define BOOST_TEST_MODULE Test Monitoring Flume
2+ #define BOOST_TEST_DYN_LINK
3+ #include < boost/test/unit_test.hpp>
4+
5+ #include " ../src/Backends/Noop.h"
6+
7+ namespace o2 {
8+ namespace monitoring {
9+ namespace Test {
10+
11+ BOOST_AUTO_TEST_CASE (noopSendMetric)
12+ {
13+ o2::monitoring::backends::Noop noopBackend{};
14+ o2::monitoring::Metric metric{10 , " myCrazyMetric" };
15+ noopBackend.send (metric);
16+ }
17+
18+ } // namespace Test
19+ } // namespace monitoring
20+ } // namespace o2
You can’t perform that action at this time.
0 commit comments