artdaq_utilities  v1_02_04a
 All Classes Namespaces Functions Variables Typedefs
Public Member Functions | List of all members
artdaq::GraphiteMetric Class Reference

Send a metric to Graphite. More...

+ Inheritance diagram for artdaq::GraphiteMetric:

Public Member Functions

 GraphiteMetric (fhicl::ParameterSet config)
 GraphiteMetric Constructor. More...
 
virtual ~GraphiteMetric ()
 GraphiteMetric Destructor. Calls stopMetrics()
 
std::string getLibName () const override
 Get the library name for the Graphite metric. More...
 
void sendMetric_ (const std::string &name, const std::string &value, const std::string &) override
 Send a metric to Graphite. More...
 
void sendMetric_ (const std::string &name, const int &value, const std::string &unit) override
 Send a metric to Graphite. More...
 
void sendMetric_ (const std::string &name, const double &value, const std::string &unit) override
 Send a metric to Graphite. More...
 
void sendMetric_ (const std::string &name, const float &value, const std::string &unit) override
 Send a metric to Graphite. More...
 
void sendMetric_ (const std::string &name, const unsigned long int &value, const std::string &unit) override
 Send a metric to Graphite. More...
 
void startMetrics_ () override
 Perform startup actions. For Graphite, this means reconnecting the socket.
 
void stopMetrics_ () override
 Perform shutdown actions. This shuts down the socket and closes it.
 
- Public Member Functions inherited from artdaq::MetricPlugin
 MetricPlugin (fhicl::ParameterSet const &ps)
 MetricPlugin Constructor. More...
 
virtual ~MetricPlugin ()=default
 Default virtual Desctructor.
 
void sendMetric (const std::string &name, const std::string &value, const std::string &unit, bool accumulate=true)
 Send a metric value to the MetricPlugin. More...
 
void sendMetric (const std::string &name, const int &value, const std::string &unit, bool accumulate=true)
 Send a metric value to the MetricPlugin. More...
 
void sendMetric (const std::string &name, const double &value, const std::string &unit, bool accumulate=true)
 Send a metric value to the MetricPlugin. More...
 
void sendMetric (const std::string &name, const float &value, const std::string &unit, bool accumulate=true)
 Send a metric value to the MetricPlugin. More...
 
void sendMetric (const std::string &name, const long unsigned int &value, const std::string &unit, bool accumulate=true)
 Send a metric value to the MetricPlugin. 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.
 
void setRunLevel (int level)
 Set the threshold for sending metrics to the underlying storage. More...
 
int getRunLevel () const
 Get the threshold for sending metrics to the underlying storage. More...
 

Additional Inherited Members

- Protected Member Functions inherited from artdaq::MetricPlugin
virtual void sendMetric_ (const std::string &name, const long unsigned int &value, const std::string &unit)=0
 Send a metric to the underlying metric storage (file, Graphite, Ganglia, etc.) More...
 
- Protected Attributes inherited from artdaq::MetricPlugin
int runLevel_
 The threshold for sending metrics to the underlying storage. Metrics with level <= to runLevel_ will be sent.
 
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.
 
bool inhibit_
 Whether to inhibit all metric sending.
 

Detailed Description

Send a metric to Graphite.

Graphite accepts metrics in a tree hiereachy, using '.' as a delimiter. Therefore, the metric artdaq.BoardReader.Fragment_Rate will appear in Graphite as: artdaq/ BoardReader/ Fragment_Rate

This plugin sends TCP messages with the following content: [name] [value] [timestamp], units are discarded

Definition at line 32 of file graphite_metric.cc.

Constructor & Destructor Documentation

artdaq::GraphiteMetric::GraphiteMetric ( fhicl::ParameterSet  config)
inlineexplicit

GraphiteMetric Constructor.

Parameters
configParameterSet used to configure GraphiteMetric
* GraphiteMetric accepts the following Parameters:
* "host" (Default: "localhost"): Destination host
* "port" (Default: 2003): Destination port
* "namespace" (Default: "artdaq."): Directory name to prepend to all metrics. Should include the trailing '.'
* 

Definition at line 55 of file graphite_metric.cc.

Member Function Documentation

std::string artdaq::GraphiteMetric::getLibName ( ) const
inlineoverridevirtual

Get the library name for the Graphite metric.

Returns
The library name for the Graphite metric, "graphite"

Reimplemented from artdaq::MetricPlugin.

Definition at line 76 of file graphite_metric.cc.

void artdaq::GraphiteMetric::sendMetric_ ( const std::string &  name,
const std::string &  value,
const std::string &   
)
inlineoverridevirtual

Send a metric to Graphite.

Parameters
nameName of the metric. Will have the namespace prepended
valueValue of the metric

Implements artdaq::MetricPlugin.

Definition at line 83 of file graphite_metric.cc.

void artdaq::GraphiteMetric::sendMetric_ ( const std::string &  name,
const int &  value,
const std::string &  unit 
)
inlineoverridevirtual

Send a metric to Graphite.

Parameters
nameName of the metric. Will have the namespace prepended
valueValue of the metric
unitUnits of the metric (Not used)

Implements artdaq::MetricPlugin.

Definition at line 112 of file graphite_metric.cc.

void artdaq::GraphiteMetric::sendMetric_ ( const std::string &  name,
const double &  value,
const std::string &  unit 
)
inlineoverridevirtual

Send a metric to Graphite.

Parameters
nameName of the metric. Will have the namespace prepended
valueValue of the metric
unitUnits of the metric (Not used)

Implements artdaq::MetricPlugin.

Definition at line 123 of file graphite_metric.cc.

void artdaq::GraphiteMetric::sendMetric_ ( const std::string &  name,
const float &  value,
const std::string &  unit 
)
inlineoverridevirtual

Send a metric to Graphite.

Parameters
nameName of the metric. Will have the namespace prepended
valueValue of the metric
unitUnits of the metric (Not used)

Implements artdaq::MetricPlugin.

Definition at line 134 of file graphite_metric.cc.

void artdaq::GraphiteMetric::sendMetric_ ( const std::string &  name,
const unsigned long int &  value,
const std::string &  unit 
)
inlineoverride

Send a metric to Graphite.

Parameters
nameName of the metric. Will have the namespace prepended
valueValue of the metric
unitUnits of the metric (Not used)

Definition at line 145 of file graphite_metric.cc.


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