artdaq_utilities  v1_05_00
MetricManager_t.cc
1 #include "artdaq-utilities/Plugins/MetricManager.hh"
2 #include "artdaq-utilities/Plugins/TestMetric.hh"
3 
4 #define BOOST_TEST_MODULES MetricManager_t
5 #include "cetlib/quiet_unit_test.hpp"
6 #include "cetlib_except/exception.h"
7 #include "fhiclcpp/make_ParameterSet.h"
8 
9 #include "trace.h"
10 
11 BOOST_AUTO_TEST_SUITE(MetricManager_test)
12 
13 typedef std::chrono::duration<double, std::ratio<1>> seconds;
14 
15 constexpr double GetElapsedTime(std::chrono::steady_clock::time_point then,
16  std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now())
17 {
18  return std::chrono::duration_cast<seconds>(now - then).count();
19 }
20 
21 BOOST_AUTO_TEST_CASE(Construct)
22 {
23  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST Construct" << TLOG_ENDL;
25  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
26  BOOST_REQUIRE_EQUAL(mm.Running(), false);
27  BOOST_REQUIRE_EQUAL(mm.Active(), false);
28  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
29  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
30  TLOG_DEBUG("MetricManager_t") << "END TEST Construct" << TLOG_ENDL;
31 }
32 
33 BOOST_AUTO_TEST_CASE(Initialize)
34 {
35  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST Initialize" << TLOG_ENDL;
37  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
38  BOOST_REQUIRE_EQUAL(mm.Running(), false);
39  BOOST_REQUIRE_EQUAL(mm.Active(), false);
40  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
41  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
42 
43  std::string testConfig = "msgFac: { level: 5 metricPluginType: test reporting_interval: 1.0}";
44  fhicl::ParameterSet pset;
45  fhicl::make_ParameterSet(testConfig, pset);
46 
47  mm.initialize(pset, "MetricManager_t");
48  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
49  BOOST_REQUIRE_EQUAL(mm.Running(), false);
50  BOOST_REQUIRE_EQUAL(mm.Active(), false);
51 
52  mm.do_start();
53  BOOST_REQUIRE_EQUAL(mm.Running(), true);
54  BOOST_REQUIRE_EQUAL(mm.Active(), true);
55  TLOG_DEBUG("MetricManager_t") << "END TEST Initialize" << TLOG_ENDL;
56 }
57 
58 BOOST_AUTO_TEST_CASE(Initialize_WithError)
59 {
60  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST Initialize_WithError" << TLOG_ENDL;
62  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
63  BOOST_REQUIRE_EQUAL(mm.Running(), false);
64  BOOST_REQUIRE_EQUAL(mm.Active(), false);
65  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
66  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
67 
68  std::string testConfig = "err: { level: 5 metricPluginType: nonExistentPluginType reporting_interval: 1.0}";
69  fhicl::ParameterSet pset;
70  fhicl::make_ParameterSet(testConfig, pset);
71 
72  mm.initialize(pset, "MetricManager_t");
73  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
74  BOOST_REQUIRE_EQUAL(mm.Running(), false);
75 
76  mm.do_start();
77  BOOST_REQUIRE_EQUAL(mm.Running(), true);
78  BOOST_REQUIRE_EQUAL(mm.Active(), false);
79  TLOG_DEBUG("MetricManager_t") << "END TEST Initialize_WithError" << TLOG_ENDL;
80 }
81 
82 BOOST_AUTO_TEST_CASE(Shutdown)
83 {
84  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST Shutdown" << TLOG_ENDL;
86  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
87  BOOST_REQUIRE_EQUAL(mm.Running(), false);
88  BOOST_REQUIRE_EQUAL(mm.Active(), false);
89  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
90  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
91 
92  std::string testConfig = "msgFac: { level: 5 metricPluginType: test reporting_interval: 1.0}";
93  fhicl::ParameterSet pset;
94  fhicl::make_ParameterSet(testConfig, pset);
95 
96  mm.initialize(pset, "MetricManager_t");
97  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
98  BOOST_REQUIRE_EQUAL(mm.Running(), false);
99  BOOST_REQUIRE_EQUAL(mm.Active(), false);
100 
101  mm.do_start();
102  BOOST_REQUIRE_EQUAL(mm.Running(), true);
103  BOOST_REQUIRE_EQUAL(mm.Active(), true);
104 
105  mm.do_stop();
106  BOOST_REQUIRE_EQUAL(mm.Running(), false);
107  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
108 
109  mm.shutdown();
110  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
111  TLOG_DEBUG("MetricManager_t") << "END TEST Shutdown" << TLOG_ENDL;
112 }
113 
114 BOOST_AUTO_TEST_CASE(SendMetric_String)
115 {
116  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST SendMetric_String" << TLOG_ENDL;
118  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
119  BOOST_REQUIRE_EQUAL(mm.Running(), false);
120  BOOST_REQUIRE_EQUAL(mm.Active(), false);
121  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
122  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
123 
124  std::string testConfig = "msgFac: { level: 5 metricPluginType: test reporting_interval: 1.0}";
125  fhicl::ParameterSet pset;
126  fhicl::make_ParameterSet(testConfig, pset);
127 
128  mm.initialize(pset, "MetricManager_t");
129  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
130  BOOST_REQUIRE_EQUAL(mm.Running(), false);
131  BOOST_REQUIRE_EQUAL(mm.Active(), false);
132 
133  mm.do_start();
134  BOOST_REQUIRE_EQUAL(mm.Running(), true);
135  BOOST_REQUIRE_EQUAL(mm.Active(), true);
136 
137  mm.sendMetric("Test Metric", "This is a test", "Units", 2, artdaq::MetricMode::LastPoint);
138 
139  mm.do_stop();
140  BOOST_REQUIRE_EQUAL(mm.Running(), false);
141  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
142 
143  mm.shutdown();
144  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
145  TLOG_DEBUG("MetricManager_t") << "END TEST SendMetric_String" << TLOG_ENDL;
146 }
147 
148 BOOST_AUTO_TEST_CASE(SendMetrics)
149 {
150  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST SendMetrics" << TLOG_ENDL;
152  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
153  BOOST_REQUIRE_EQUAL(mm.Running(), false);
154  BOOST_REQUIRE_EQUAL(mm.Active(), false);
155  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
156  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
157 
158  std::string testConfig = "msgFac: { level: 5 metricPluginType: test reporting_interval: 0.01}";
159  fhicl::ParameterSet pset;
160  fhicl::make_ParameterSet(testConfig, pset);
161 
162  mm.initialize(pset, "MetricManager_t");
163  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
164  BOOST_REQUIRE_EQUAL(mm.Running(), false);
165  BOOST_REQUIRE_EQUAL(mm.Active(), false);
166 
167  mm.do_start();
168  BOOST_REQUIRE_EQUAL(mm.Running(), true);
169  BOOST_REQUIRE_EQUAL(mm.Active(), true);
170 
171  mm.sendMetric("Test Metric LastPoint", 1, "Units", 2, artdaq::MetricMode::LastPoint, "", true);
172  mm.sendMetric("Test Metric LastPoint", 5, "Units", 2, artdaq::MetricMode::LastPoint, "", true);
173  usleep(100000);
174  {
175  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
176  bool present = false;
177  for (auto& point : artdaq::TestMetric::received_metrics)
178  {
179  TLOG(TLVL_DEBUG) << "Metric: " << point.metric << ", Value: " << point.value << ", Units: " << point.unit;
180  if (point.metric == "Test Metric LastPoint")
181  {
182  BOOST_REQUIRE_EQUAL(point.value, "5");
183  BOOST_REQUIRE_EQUAL(point.unit, "Units");
184  present = true;
185  }
186  }
187  BOOST_REQUIRE(present);
188  artdaq::TestMetric::received_metrics.clear();
189  }
190 
191  mm.sendMetric("Test Metric Accumulate", 4, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
192  mm.sendMetric("Test Metric Accumulate", 5, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
193  usleep(100000);
194  {
195  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
196  bool present = false;
197  for (auto& point : artdaq::TestMetric::received_metrics)
198  {
199  if (point.metric == "Test Metric Accumulate")
200  {
201  BOOST_REQUIRE_EQUAL(point.value, "9");
202  BOOST_REQUIRE_EQUAL(point.unit, "Units");
203  present = true;
204  }
205  }
206  BOOST_REQUIRE(present);
207  artdaq::TestMetric::received_metrics.clear();
208  }
209 
210  mm.sendMetric("Test Metric Average", 1, "Units", 2, artdaq::MetricMode::Average, "", true);
211  mm.sendMetric("Test Metric Average", 3, "Units", 2, artdaq::MetricMode::Average, "", true);
212  usleep(100000);
213  {
214  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
215  bool present = false;
216  for (auto& point : artdaq::TestMetric::received_metrics)
217  {
218  if (point.metric == "Test Metric Average")
219  {
220  BOOST_REQUIRE_EQUAL(std::stof(point.value), 2);
221  BOOST_REQUIRE_EQUAL(point.unit, "Units");
222  present = true;
223  }
224  }
225  BOOST_REQUIRE(present);
226  artdaq::TestMetric::received_metrics.clear();
227  }
228 
229  mm.sendMetric("Test Metric Rate", 4, "Units", 2, artdaq::MetricMode::Rate, "", true);
230  mm.sendMetric("Test Metric Rate", 5, "Units", 2, artdaq::MetricMode::Rate, "", true);
231  usleep(100000);
232  {
233  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
234  bool present = false;
235  for (auto& point : artdaq::TestMetric::received_metrics)
236  {
237  if (point.metric == "Test Metric Rate")
238  {
239  BOOST_REQUIRE_EQUAL(point.unit, "Units/s");
240  present = true;
241  }
242  }
243  BOOST_REQUIRE(present);
244  artdaq::TestMetric::received_metrics.clear();
245  }
246 
247  mm.sendMetric("Test Metric AccumulateAndRate", 4, "Units", 2, artdaq::MetricMode::Accumulate | artdaq::MetricMode::Rate, "", true);
248  mm.sendMetric("Test Metric AccumulateAndRate", 5, "Units", 2, artdaq::MetricMode::Accumulate | artdaq::MetricMode::Rate, "", true);
249  usleep(100000);
250  {
251  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
252  int present = 0;
253  for (auto& point : artdaq::TestMetric::received_metrics)
254  {
255  if (point.metric == "Test Metric AccumulateAndRate - Total")
256  {
257  BOOST_REQUIRE_EQUAL(point.value, "9");
258  BOOST_REQUIRE_EQUAL(point.unit, "Units");
259  present++;
260  }
261  if (point.metric == "Test Metric AccumulateAndRate - Rate")
262  {
263  BOOST_REQUIRE_EQUAL(point.unit, "Units/s");
264  present++;
265  }
266  }
267  BOOST_REQUIRE_EQUAL(present, 2);
268  artdaq::TestMetric::received_metrics.clear();
269  }
270 
271  mm.do_stop();
272  BOOST_REQUIRE_EQUAL(mm.Running(), false);
273  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
274 
275  mm.shutdown();
276  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
277  TLOG_DEBUG("MetricManager_t") << "END TEST SendMetrics" << TLOG_ENDL;
278 }
279 
280 BOOST_AUTO_TEST_CASE(SendMetrics_Levels)
281 {
282  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST SendMetrics_Levels" << TLOG_ENDL;
284  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
285  BOOST_REQUIRE_EQUAL(mm.Running(), false);
286  BOOST_REQUIRE_EQUAL(mm.Active(), false);
287  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
288  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
289 
290  std::string testConfig = "msgFac: { level: 0 metric_levels: [ 1, 2 ] level_string: \"3-5,9,7\" metricPluginType: test reporting_interval: 0.01}";
291  fhicl::ParameterSet pset;
292  fhicl::make_ParameterSet(testConfig, pset);
293 
294  mm.initialize(pset, "MetricManager_t");
295  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
296  BOOST_REQUIRE_EQUAL(mm.Running(), false);
297  BOOST_REQUIRE_EQUAL(mm.Active(), false);
298 
299  mm.do_start();
300  BOOST_REQUIRE_EQUAL(mm.Running(), true);
301  BOOST_REQUIRE_EQUAL(mm.Active(), true);
302 
303  mm.sendMetric("Test Metric 0", 0, "Units", 0, artdaq::MetricMode::LastPoint, "", true);
304  mm.sendMetric("Test Metric 1", 1, "Units", 1, artdaq::MetricMode::LastPoint, "", true);
305  mm.sendMetric("Test Metric 2", 2, "Units", 2, artdaq::MetricMode::LastPoint, "", true);
306  mm.sendMetric("Test Metric 3", 3, "Units", 3, artdaq::MetricMode::LastPoint, "", true);
307  mm.sendMetric("Test Metric 4", 4, "Units", 4, artdaq::MetricMode::LastPoint, "", true);
308  mm.sendMetric("Test Metric 5", 5, "Units", 5, artdaq::MetricMode::LastPoint, "", true);
309  mm.sendMetric("Test Metric 6", 6, "Units", 6, artdaq::MetricMode::LastPoint, "", true);
310  mm.sendMetric("Test Metric 7", 7, "Units", 7, artdaq::MetricMode::LastPoint, "", true);
311  mm.sendMetric("Test Metric 8", 8, "Units", 8, artdaq::MetricMode::LastPoint, "", true);
312  mm.sendMetric("Test Metric 9", 9, "Units", 9, artdaq::MetricMode::LastPoint, "", true);
313  mm.sendMetric("Test Metric 10", 10, "Units", 10, artdaq::MetricMode::LastPoint, "", true);
314  std::bitset<11> received_metrics_;
315  usleep(100000);
316  {
317  std::lock_guard<std::mutex> lk(artdaq::TestMetric::received_metrics_mutex);
318  for (auto& point : artdaq::TestMetric::received_metrics)
319  {
320  if (point.metric == "Test Metric 0")
321  {
322  BOOST_REQUIRE_EQUAL(point.value, "0");
323  BOOST_REQUIRE_EQUAL(point.unit, "Units");
324  received_metrics_[0] = true;
325  }
326  if (point.metric == "Test Metric 1")
327  {
328  BOOST_REQUIRE_EQUAL(point.value, "1");
329  BOOST_REQUIRE_EQUAL(point.unit, "Units");
330  received_metrics_[1] = true;
331  }
332  if (point.metric == "Test Metric 2")
333  {
334  BOOST_REQUIRE_EQUAL(point.value, "2");
335  BOOST_REQUIRE_EQUAL(point.unit, "Units");
336  received_metrics_[2] = true;
337  }
338  if (point.metric == "Test Metric 3")
339  {
340  BOOST_REQUIRE_EQUAL(point.value, "3");
341  BOOST_REQUIRE_EQUAL(point.unit, "Units");
342  received_metrics_[3] = true;
343  }
344  if (point.metric == "Test Metric 4")
345  {
346  BOOST_REQUIRE_EQUAL(point.value, "4");
347  BOOST_REQUIRE_EQUAL(point.unit, "Units");
348  received_metrics_[4] = true;
349  }
350  if (point.metric == "Test Metric 5")
351  {
352  BOOST_REQUIRE_EQUAL(point.value, "5");
353  BOOST_REQUIRE_EQUAL(point.unit, "Units");
354  received_metrics_[5] = true;
355  }
356  if (point.metric == "Test Metric 6")
357  {
358  BOOST_TEST_FAIL("Metric level 6 should not have been sent!");
359  received_metrics_[6] = true;
360  }
361  if (point.metric == "Test Metric 7")
362  {
363  BOOST_REQUIRE_EQUAL(point.value, "7");
364  BOOST_REQUIRE_EQUAL(point.unit, "Units");
365  received_metrics_[7] = true;
366  }
367  if (point.metric == "Test Metric 8")
368  {
369  BOOST_TEST_FAIL("Metric level 8 should not have been sent!");
370  received_metrics_[8] = true;
371  }
372  if (point.metric == "Test Metric 9")
373  {
374  BOOST_REQUIRE_EQUAL(point.value, "9");
375  BOOST_REQUIRE_EQUAL(point.unit, "Units");
376  received_metrics_[9] = true;
377  }
378  if (point.metric == "Test Metric 10")
379  {
380  BOOST_TEST_FAIL("Metric level 10 should not have been sent!");
381  received_metrics_[10] = true;
382  }
383  }
384  BOOST_REQUIRE_EQUAL(received_metrics_.to_ulong(), 0x2BF);
385  artdaq::TestMetric::received_metrics.clear();
386  }
387 
388  mm.do_stop();
389  BOOST_REQUIRE_EQUAL(mm.Running(), false);
390  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
391 
392  mm.shutdown();
393  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
394  TLOG_DEBUG("MetricManager_t") << "END TEST SendMetrics_Levels" << TLOG_ENDL;
395 }
396 
397 BOOST_AUTO_TEST_CASE(MetricFlood)
398 {
399  TLOG_DEBUG("MetricManager_t") << "BEGIN TEST MetricFlood" << TLOG_ENDL;
401  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
402  BOOST_REQUIRE_EQUAL(mm.Running(), false);
403  BOOST_REQUIRE_EQUAL(mm.Active(), false);
404  BOOST_REQUIRE_EQUAL(mm.metricQueueEmpty(), true);
405  BOOST_REQUIRE_EQUAL(mm.metricQueueSize(), 0);
406 
407  std::string testConfig = "msgFac: { level: 5 metricPluginType: test reporting_interval: 1.0}";
408  fhicl::ParameterSet pset;
409  fhicl::make_ParameterSet(testConfig, pset);
410 
411  mm.initialize(pset, "MetricManager_t");
412  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
413  BOOST_REQUIRE_EQUAL(mm.Running(), false);
414  BOOST_REQUIRE_EQUAL(mm.Active(), false);
415 
416  mm.do_start();
417  BOOST_REQUIRE_EQUAL(mm.Running(), true);
418  BOOST_REQUIRE_EQUAL(mm.Active(), true);
419 
420  auto beforeOne = std::chrono::steady_clock::now();
421  mm.sendMetric("Test Metric 1", 1, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
422  auto afterOne = std::chrono::steady_clock::now();
423 
424  sleep(2);
425 
426  auto beforeTen = std::chrono::steady_clock::now();
427  for (auto ii = 1; ii <= 10; ++ii)
428  {
429  mm.sendMetric("Test Metric 10", ii, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
430  }
431  auto afterTen = std::chrono::steady_clock::now();
432 
433  sleep(2);
434 
435  auto beforeOneHundred = std::chrono::steady_clock::now();
436  for (auto ii = 1; ii <= 100; ++ii)
437  {
438  mm.sendMetric("Test Metric 100", ii, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
439  }
440  auto afterOneHundred = std::chrono::steady_clock::now();
441 
442  sleep(2);
443 
444  auto beforeOneThousand = std::chrono::steady_clock::now();
445  for (auto ii = 1; ii <= 1000; ++ii)
446  {
447  mm.sendMetric("Test Metric 1000", ii, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
448  }
449  auto afterOneThousand = std::chrono::steady_clock::now();
450 
451  sleep(2);
452 
453  auto beforeTenThousand = std::chrono::steady_clock::now();
454  for (auto ii = 1; ii <= 10000; ++ii)
455  {
456  mm.sendMetric("Test Metric 10000", ii, "Units", 2, artdaq::MetricMode::Accumulate, "", true);
457  }
458  auto afterTenThousand = std::chrono::steady_clock::now();
459 
460  auto beforeStop = std::chrono::steady_clock::now();
461  mm.do_stop();
462  BOOST_REQUIRE_EQUAL(mm.Running(), false);
463  BOOST_REQUIRE_EQUAL(mm.Initialized(), true);
464  auto afterStop = std::chrono::steady_clock::now();
465 
466  TLOG_INFO("MetricManager_t") << "Time for One Metric: " << GetElapsedTime(beforeOne, afterOne) << " s." << TLOG_ENDL;
467  TLOG_INFO("MetricManager_t") << "Time for Ten Metrics: " << GetElapsedTime(beforeTen, afterTen) << " s." << TLOG_ENDL;
468  TLOG_INFO("MetricManager_t") << "Time for One Hundred Metrics: " << GetElapsedTime(beforeOneHundred, afterOneHundred)
469  << " s." << TLOG_ENDL;
470  TLOG_INFO("MetricManager_t") << "Time for One Thousand Metrics: "
471  << GetElapsedTime(beforeOneThousand, afterOneThousand) << " s." << TLOG_ENDL;
472  TLOG_INFO("MetricManager_t") << "Time for Ten Thousand Metrics: "
473  << GetElapsedTime(beforeTenThousand, afterTenThousand) << " s." << TLOG_ENDL;
474  TLOG_INFO("MetricManager_t") << "Time for Stop Metrics: " << GetElapsedTime(beforeStop, afterStop) << " s."
475  << TLOG_ENDL;
476 
477  mm.shutdown();
478  BOOST_REQUIRE_EQUAL(mm.Initialized(), false);
479  TLOG_DEBUG("MetricManager_t") << "END TEST MetricFlood" << TLOG_ENDL;
480 }
481 
482 BOOST_AUTO_TEST_SUITE_END()
void shutdown()
Call the destructors for all configured MetricPlugin instances.
void initialize(fhicl::ParameterSet const &pset, std::string const &prefix="")
Initialize the MetricPlugin instances.
bool Initialized()
Returns whether the MetricManager has been initialized (configured)
void sendMetric(std::string const &name, std::string const &value, std::string const &unit, int level, MetricMode mode, std::string const &metricPrefix="", bool useNameOverride=false)
Send a metric with the given parameters to any MetricPlugins with a threshold level &gt;= to level...
size_t metricQueueSize(std::string const &name="")
Return the size of the named metric queue
Report the sum of all values. Use for counters to report accurate results.
void do_start()
Perform startup actions for each configured MetricPlugin.
bool Running()
Returns whether the MetricManager is running (accepting metric calls)
void do_stop()
Stop sending metrics to the MetricPlugin instances.
Report only the last value recorded. Useful for event counters, run numbers, etc. ...
The MetricManager class handles loading metric plugins and asynchronously sending metric data to them...
bool Active()
Returns whether any Metric Plugins are defined and configured
bool metricQueueEmpty()
Returns whether the metric queue is completely empty
Report the average of all values. Use for rates to report accurate results.