artdaq_utilities  v1_04_10
artdaq::MetricManager Class Reference

The MetricManager class handles loading metric plugins and asynchronously sending metric data to them. It is designed to be a "black hole" for metrics, taking as little time as possible so that metrics do not impact the data-taking performance. More...

#include <artdaq-utilities/Plugins/MetricManager.hh>

Classes

struct  Config
 The Config struct defines the accepted configuration parameters for this class. More...
 

Public Types

using Parameters = fhicl::WrappedTable< Config >
 

Public Member Functions

 MetricManager ()
 Construct an instance of the MetricManager class.
 
 MetricManager (MetricManager const &)=delete
 Copy Constructor is deleted.
 
virtual ~MetricManager () noexcept
 MetricManager destructor. More...
 
MetricManageroperator= (MetricManager const &)=delete
 Copy Assignment operator is deleted. More...
 
void initialize (fhicl::ParameterSet const &pset, std::string const &prefix="")
 Initialize the MetricPlugin instances. More...
 
void do_start ()
 Perform startup actions for each configured MetricPlugin.
 
void do_stop ()
 Stop sending metrics to the MetricPlugin instances.
 
void do_pause ()
 Pause metric sending. Currently a No-Op.
 
void do_resume ()
 Resume metric sending. Currently a No-Op.
 
void reinitialize (fhicl::ParameterSet const &pset, std::string const &prefix="")
 Reinitialize all MetricPlugin Instances. More...
 
void shutdown ()
 Call the destructors for all configured MetricPlugin instances.
 
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 >= to level. More...
 
void sendMetric (std::string const &name, int 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 >= to level. More...
 
void sendMetric (std::string const &name, double 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 >= to level. More...
 
void sendMetric (std::string const &name, float 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 >= to level. More...
 
void sendMetric (std::string const &name, long unsigned int 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 >= to level. More...
 
void setPrefix (std::string const &prefix)
 Sets the prefix prepended to all metrics without useNameOverride set. More...
 
bool Initialized ()
 Returns whether the MetricManager has been initialized (configured) More...
 
bool Running ()
 Returns whether the MetricManager is running (accepting metric calls) More...
 
bool Active ()
 Returns whether any Metric Plugins are defined and configured More...
 
bool metricQueueEmpty ()
 Returns whether the metric queue is completely empty More...
 
size_t metricQueueSize (std::string const &name="")
 Return the size of the named metric queue More...
 

Detailed Description

The MetricManager class handles loading metric plugins and asynchronously sending metric data to them. It is designed to be a "black hole" for metrics, taking as little time as possible so that metrics do not impact the data-taking performance.

Definition at line 33 of file MetricManager.hh.

Constructor & Destructor Documentation

artdaq::MetricManager::~MetricManager ( )
virtualnoexcept

MetricManager destructor.

Calls shutdown()

Definition at line 29 of file MetricManager.cc.

Member Function Documentation

bool artdaq::MetricManager::Active ( )
inline

Returns whether any Metric Plugins are defined and configured

Returns
True if a Metric Plugin can accept metrics

Definition at line 237 of file MetricManager.hh.

void artdaq::MetricManager::initialize ( fhicl::ParameterSet const &  pset,
std::string const &  prefix = "" 
)

Initialize the MetricPlugin instances.

Parameters
psetThe ParameterSet used to configure the MetricPlugin instances
prefixThe prefix to prepend to all metric names, unless useNameOverride is set to true

The ParameterSet should be a collection of tables, each configuring a MetricPlugin. See the MetricPlugin documentation for how to configure a MetricPlugin. "metric_queue_size": (Default: 1000): The maximum number of metric entries which can be stored in the metric queue. "metric_queue_notify_size": (Default: 10): The number of metric entries in the list which will cause reports of the queue size to be printed. "metric_send_maximum_delay_ms": (Default: 15000): The maximum amount of time between metric send calls (will send 0s for metrics which have not reported in this interval) If the queue is above this size, new metric entries will be dropped until the plugins catch up.

Definition at line 31 of file MetricManager.cc.

bool artdaq::MetricManager::Initialized ( )
inline

Returns whether the MetricManager has been initialized (configured)

Returns
True if MetricManager is initialized

Definition at line 225 of file MetricManager.hh.

bool artdaq::MetricManager::metricQueueEmpty ( )

Returns whether the metric queue is completely empty

Returns
True if the metric queue is empty

Definition at line 344 of file MetricManager.cc.

size_t artdaq::MetricManager::metricQueueSize ( std::string const &  name = "")

Return the size of the named metric queue

Parameters
nameName of the metric queue to query. "" returns size of all queues (default)
Returns
Size of selected metric queue

Definition at line 349 of file MetricManager.cc.

MetricManager& artdaq::MetricManager::operator= ( MetricManager const &  )
delete

Copy Assignment operator is deleted.

Returns
MetricManager copy
void artdaq::MetricManager::reinitialize ( fhicl::ParameterSet const &  pset,
std::string const &  prefix = "" 
)

Reinitialize all MetricPlugin Instances.

Parameters
psetParameterSet used to configure the MetricPlugin instances
prefixPrefix to apply to Metric names

Calls shutdown(), then initialize(pset, prefix).

Definition at line 114 of file MetricManager.cc.

bool artdaq::MetricManager::Running ( )
inline

Returns whether the MetricManager is running (accepting metric calls)

Returns
True if MetricManager is running

Definition at line 231 of file MetricManager.hh.

void artdaq::MetricManager::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 >= to level.

Parameters
nameThe Name of the metric
valueThe value of the metric
unitThe units of the metric
levelThe verbosity level of the metric. Higher number == more verbose
modeThe MetricMode that the metric should operate in. Options are: LastPoint: Every reporting_interval, the latest metric value is sent (For run/event numbers, etc) Accumulate: Every reporting_interval, the sum of all metric values since the last report is sent (for counters) Average: Every reporting_interval, the average of all metric values since the last report is sent (for rates)
metricPrefixAn additional prefix to prepend to the metric name
useNameOverrideWhether to use name verbatim and not apply prefixes

Definition at line 140 of file MetricManager.cc.

void artdaq::MetricManager::sendMetric ( std::string const &  name,
int 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 >= to level.

Parameters
nameThe Name of the metric
valueThe value of the metric
unitThe units of the metric
levelThe verbosity level of the metric. Higher number == more verbose
modeThe MetricMode that the metric should operate in. Options are: LastPoint: Every reporting_interval, the latest metric value is sent (For run/event numbers, etc) Accumulate: Every reporting_interval, the sum of all metric values since the last report is sent (for counters) Average: Every reporting_interval, the average of all metric values since the last report is sent (for rates)
metricPrefixAn additional prefix to prepend to the metric name
useNameOverrideWhether to use name verbatim and not apply prefixes

Definition at line 178 of file MetricManager.cc.

void artdaq::MetricManager::sendMetric ( std::string const &  name,
double 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 >= to level.

Parameters
nameThe Name of the metric
valueThe value of the metric
unitThe units of the metric
levelThe verbosity level of the metric. Higher number == more verbose
modeThe MetricMode that the metric should operate in. Options are: LastPoint: Every reporting_interval, the latest metric value is sent (For run/event numbers, etc) Accumulate: Every reporting_interval, the sum of all metric values since the last report is sent (for counters) Average: Every reporting_interval, the average of all metric values since the last report is sent (for rates)
metricPrefixAn additional prefix to prepend to the metric name
useNameOverrideWhether to use name verbatim and not apply prefixes

Definition at line 215 of file MetricManager.cc.

void artdaq::MetricManager::sendMetric ( std::string const &  name,
float 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 >= to level.

Parameters
nameThe Name of the metric
valueThe value of the metric
unitThe units of the metric
levelThe verbosity level of the metric. Higher number == more verbose
modeThe MetricMode that the metric should operate in. Options are: LastPoint: Every reporting_interval, the latest metric value is sent (For run/event numbers, etc) Accumulate: Every reporting_interval, the sum of all metric values since the last report is sent (for counters) Average: Every reporting_interval, the average of all metric values since the last report is sent (for rates)
metricPrefixAn additional prefix to prepend to the metric name
useNameOverrideWhether to use name verbatim and not apply prefixes

Definition at line 252 of file MetricManager.cc.

void artdaq::MetricManager::sendMetric ( std::string const &  name,
long unsigned int 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 >= to level.

Parameters
nameThe Name of the metric
valueThe value of the metric
unitThe units of the metric
levelThe verbosity level of the metric. Higher number == more verbose
modeThe MetricMode that the metric should operate in. Options are: LastPoint: Every reporting_interval, the latest metric value is sent (For run/event numbers, etc) Accumulate: Every reporting_interval, the sum of all metric values since the last report is sent (for counters) Average: Every reporting_interval, the average of all metric values since the last report is sent (for rates)
metricPrefixAn additional prefix to prepend to the metric name
useNameOverrideWhether to use name verbatim and not apply prefixes

Definition at line 289 of file MetricManager.cc.

void artdaq::MetricManager::setPrefix ( std::string const &  prefix)
inline

Sets the prefix prepended to all metrics without useNameOverride set.

Parameters
prefixThe prefix to prepend. Delimiter character in names is "."

Definition at line 219 of file MetricManager.hh.


The documentation for this class was generated from the following files: