The MetricPlugin class defines the interface that MetricManager uses to send metric data to the various metric plugins.
More...
#include <artdaq-utilities/Plugins/MetricPlugin.hh>
|
struct | Config |
| The Config struct defines the accepted configuration parameters for this class. More...
|
|
|
using | Parameters = fhicl::WrappedTable< Config > |
| Used for ParameterSet validation (if desired)
|
|
|
| MetricPlugin (fhicl::ParameterSet const &ps, std::string const &app_name) |
| MetricPlugin Constructor. More...
|
|
virtual | ~MetricPlugin ()=default |
| Default virtual Desctructor.
|
|
virtual std::string | getLibName () const |
| Return the name of the current MetricPlugin instance.
|
|
void | addMetricData (std::unique_ptr< MetricData > const &data) |
| Send a metric value to the MetricPlugin. More...
|
|
void | sendMetrics (bool forceSend=false, std::chrono::steady_clock::time_point interval_end=std::chrono::steady_clock::now()) |
| For each known metric, determine whether the reporting interval has elapsed, and if so, report a value to the underlying metric storage. More...
|
|
void | startMetrics () |
| Perform startup actions. Simply calls the virtual startMetrics_ function.
|
|
void | stopMetrics () |
| Perform shutdown actions. Zeroes out all accumulators, and sends zeros for each metric. Calls stopMetrics_() for any plugin-defined shutdown actions.
|
|
bool | IsLevelEnabled (int level) |
| Determine if the given level is enabled for this MetricPlugin instance. More...
|
|
bool | metricsPending () |
| Determine if metrics are waiting to be sent. More...
|
|
|
virtual void | sendMetric_ (const std::string &name, const std::string &value, const std::string &unit)=0 |
| Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
|
|
virtual void | sendMetric_ (const std::string &name, const int &value, const std::string &unit)=0 |
| Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
|
|
virtual void | sendMetric_ (const std::string &name, const double &value, const std::string &unit)=0 |
| Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
|
|
virtual void | sendMetric_ (const std::string &name, const float &value, const std::string &unit)=0 |
| Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
|
|
virtual void | sendMetric_ (const std::string &name, const uint64_t &value, const std::string &unit)=0 |
| Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
|
|
virtual void | startMetrics_ ()=0 |
| Perform any start-up actions necessary for the metric plugin. More...
|
|
virtual void | stopMetrics_ ()=0 |
| Perform any shutdown actions necessary for the metric plugin. More...
|
|
|
fhicl::ParameterSet | pset |
| The ParameterSet used to configure the MetricPlugin.
|
|
double | accumulationTime_ |
| The amount of time to average metric values; except for accumulate=false metrics, will be the interval at which each metric is sent.
|
|
std::string | app_name_ |
| Name of the application which is sending metrics to this plugin.
|
|
bool | inhibit_ |
| Flag to indicate that the MetricPlugin is being stopped, and any metric back-ends which do not have a persistent state (i.e. file) should not report further metrics.
|
|
std::bitset< 64 > | level_mask_ |
| Bitset indicating for each possible metric level, whether this plugin will receive those metrics.
|
|
bool | sendZeros_ |
| Whether zeros should be sent to this metric backend when metric instances are missing or at the end of the run.
|
|
The MetricPlugin class defines the interface that MetricManager uses to send metric data to the various metric plugins.
Definition at line 37 of file MetricPlugin.hh.
artdaq::MetricPlugin::MetricPlugin |
( |
fhicl::ParameterSet const & |
ps, |
|
|
std::string const & |
app_name |
|
) |
| |
|
inlineexplicit |
MetricPlugin Constructor.
- Parameters
-
ps | The ParameterSet used to configure this MetricPlugin instance |
app_name | The Application name which can be used by the Metric Plugin for identification |
Calling sendMetric with the accumulate parameter set to false will bypass this accumulation and directly send the metric. String metrics cannot be accumulated.
Definition at line 69 of file MetricPlugin.hh.
void artdaq::MetricPlugin::addMetricData |
( |
std::unique_ptr< MetricData > const & |
data | ) |
|
|
inline |
bool artdaq::MetricPlugin::IsLevelEnabled |
( |
int |
level | ) |
|
|
inline |
Determine if the given level is enabled for this MetricPlugin instance.
- Parameters
-
- Returns
- True if level is enabled, false otherwise
Definition at line 394 of file MetricPlugin.hh.
bool artdaq::MetricPlugin::metricsPending |
( |
| ) |
|
|
inline |
Determine if metrics are waiting to be sent.
- Returns
- True if metrics have been queued for sending by this MetricPlugin instance
Definition at line 405 of file MetricPlugin.hh.
virtual void artdaq::MetricPlugin::sendMetric_ |
( |
const std::string & |
name, |
|
|
const std::string & |
value, |
|
|
const std::string & |
unit |
|
) |
| |
|
protectedpure virtual |
Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.)
- Parameters
-
name | Name of the metric |
value | Value of the metric |
unit | Units for the metric |
Note this is a pure virtual function, it should be overridden by implementation plugins
Implemented in artdaq::FileMetric, artdaq::MsgFacilityMetric, artdaq::GraphiteMetric, artdaq::ProcFileMetric, artdaq::PeriodicReportMetric, artdaq::TestMetricImpl, and artdaqtest::MetricPluginTestAdapter.
virtual void artdaq::MetricPlugin::sendMetric_ |
( |
const std::string & |
name, |
|
|
const int & |
value, |
|
|
const std::string & |
unit |
|
) |
| |
|
protectedpure virtual |
Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.)
- Parameters
-
name | Name of the metric |
value | Value of the metric |
unit | Units for the metric |
Note this is a pure virtual function, it should be overridden by implementation plugins
Implemented in artdaq::FileMetric, artdaq::MsgFacilityMetric, artdaq::GraphiteMetric, artdaq::ProcFileMetric, artdaq::PeriodicReportMetric, artdaq::TestMetricImpl, and artdaqtest::MetricPluginTestAdapter.
virtual void artdaq::MetricPlugin::sendMetric_ |
( |
const std::string & |
name, |
|
|
const double & |
value, |
|
|
const std::string & |
unit |
|
) |
| |
|
protectedpure virtual |
Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.)
- Parameters
-
name | Name of the metric |
value | Value of the metric |
unit | Units for the metric |
Note this is a pure virtual function, it should be overridden by implementation plugins
Implemented in artdaq::FileMetric, artdaq::MsgFacilityMetric, artdaq::GraphiteMetric, artdaq::ProcFileMetric, artdaq::PeriodicReportMetric, artdaq::TestMetricImpl, and artdaqtest::MetricPluginTestAdapter.
virtual void artdaq::MetricPlugin::sendMetric_ |
( |
const std::string & |
name, |
|
|
const float & |
value, |
|
|
const std::string & |
unit |
|
) |
| |
|
protectedpure virtual |
Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.)
- Parameters
-
name | Name of the metric |
value | Value of the metric |
unit | Units for the metric |
Note this is a pure virtual function, it should be overridden by implementation plugins
Implemented in artdaq::FileMetric, artdaq::MsgFacilityMetric, artdaq::GraphiteMetric, artdaq::ProcFileMetric, artdaq::PeriodicReportMetric, artdaq::TestMetricImpl, and artdaqtest::MetricPluginTestAdapter.
virtual void artdaq::MetricPlugin::sendMetric_ |
( |
const std::string & |
name, |
|
|
const uint64_t & |
value, |
|
|
const std::string & |
unit |
|
) |
| |
|
protectedpure virtual |
Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.)
- Parameters
-
name | Name of the metric |
value | Value of the metric |
unit | Units for the metric |
Note this is a pure virtual function, it should be overridden by implementation plugins
Implemented in artdaq::FileMetric, artdaq::MsgFacilityMetric, artdaq::GraphiteMetric, artdaq::ProcFileMetric, artdaq::PeriodicReportMetric, artdaq::TestMetricImpl, and artdaqtest::MetricPluginTestAdapter.
void artdaq::MetricPlugin::sendMetrics |
( |
bool |
forceSend = false , |
|
|
std::chrono::steady_clock::time_point |
interval_end = std::chrono::steady_clock::now() |
|
) |
| |
|
inline |
For each known metric, determine whether the reporting interval has elapsed, and if so, report a value to the underlying metric storage.
- Parameters
-
forceSend | (Default = false): Force sending metrics, even if reporting interval has not elapsed |
interval_end | (Default = now): For calculating rates, when the current reporting interval ended (interval began at last value of interval_end) |
Definition at line 250 of file MetricPlugin.hh.
virtual void artdaq::MetricPlugin::startMetrics_ |
( |
| ) |
|
|
protectedpure virtual |
virtual void artdaq::MetricPlugin::stopMetrics_ |
( |
| ) |
|
|
protectedpure virtual |
The documentation for this class was generated from the following file: