Monitoring
3.3.4
O2 Monitoring library
|
Represents a metric including value, type of the value, name, timestamp and tags. More...
#include <Metric.h>
Public Member Functions | |
Metric (int value, const std::string &name, Verbosity verbosity=Metric::DefaultVerbosity) | |
Metric (std::string value, const std::string &name, Verbosity verbosity=Metric::DefaultVerbosity) | |
Metric (double value, const std::string &name, Verbosity verbosity=Metric::DefaultVerbosity) | |
Metric (uint64_t value, const std::string &name, Verbosity verbosity=Metric::DefaultVerbosity) | |
Metric (const std::string &name, Verbosity verbosity=Metric::DefaultVerbosity, const std::chrono::time_point< std::chrono::system_clock > ×tamp=Metric::getCurrentTimestamp()) | |
Metric && | addValue (int value, const std::string &name) |
Metric && | addValue (double value, const std::string &name) |
Metric && | addValue (uint64_t value, const std::string &name) |
Metric && | addValue (std::string value, const std::string &name) |
Metric && | addValue (const std::variant< int, std::string, double, uint64_t > &value, const std::string &name) |
~Metric ()=default | |
Default destructor. | |
const std::string & | getName () const |
std::chrono::time_point< std::chrono::system_clock > | getTimestamp () const |
const std::vector< std::pair< std::string, std::variant< int, std::string, double, uint64_t > > > & | getValues () const |
const std::pair< std::string, std::variant< int, std::string, double, uint64_t > > & | getFirstValue () const |
std::size_t | getValuesSize () const noexcept |
Values vector size getter. | |
const std::vector< std::pair< int, int > > & | getTags () const |
Metric && | addTag (tags::Key key, tags::Value value) |
Metric && | addTag (tags::Key key, unsigned short int number) |
Verbosity | getVerbosity () |
Verbosity getter. | |
int | getFirstValueType () const |
This is required for backward compability with boost::variant and old StdOut format. | |
Static Public Member Functions | |
static auto | getCurrentTimestamp () -> decltype(std::chrono::system_clock::now()) |
static void | setDefaultVerbosity (Verbosity verbosity) |
Sets default verbosity of metrics. | |
static void | setVerbosityPolicy (Verbosity verbosity, const std::regex ®ex) |
Regex policy setter. | |
Static Public Attributes | |
static Verbosity | DefaultVerbosity = Verbosity::Info |
Default metric verbosity. | |
static bool | includeTimestamp = true |
Whether timestamp should be included or not. | |
Protected Member Functions | |
Metric && | setTags (std::vector< std::pair< int, int >> &&tags) |
Set full vector of tags. | |
void | overwriteVerbosity () |
Overwirte verbosity using regex policy. | |
Protected Attributes | |
std::vector< std::pair< std::string, std::variant< int, std::string, double, uint64_t > > > | mValues |
Metric values. | |
std::string | mName |
Metric name. | |
std::chrono::time_point< std::chrono::system_clock > | mTimestamp |
Metric timestamp. | |
std::vector< std::pair< int, int > > | mTags |
Metric tags. | |
Verbosity | mVerbosity |
Metric verbosity. | |
Static Protected Attributes | |
static std::map< std::underlying_type< Verbosity >::type, std::regex > | mRegexPolicy |
Regex policy map. | |
static constexpr char | mDefaultValueName [] = "value" |
Default value name. | |
Friends | |
class | o2::monitoring::DerivedMetrics |
Allow DerivedMetrics access to setTags. | |
Represents a metric including value, type of the value, name, timestamp and tags.
o2::monitoring::Metric::Metric | ( | int | value, |
const std::string & | name, | ||
Verbosity | verbosity = Metric::DefaultVerbosity |
||
) |
Integer metric construtor
value | metric value (int) |
name | metric name |
o2::monitoring::Metric::Metric | ( | std::string | value, |
const std::string & | name, | ||
Verbosity | verbosity = Metric::DefaultVerbosity |
||
) |
String metric construtor
value | metric value (string) |
name | the metric name |
o2::monitoring::Metric::Metric | ( | double | value, |
const std::string & | name, | ||
Verbosity | verbosity = Metric::DefaultVerbosity |
||
) |
Double metric constructor
value | metric value (double) |
name | metric name |
o2::monitoring::Metric::Metric | ( | uint64_t | value, |
const std::string & | name, | ||
Verbosity | verbosity = Metric::DefaultVerbosity |
||
) |
uint64_t metric constructor
value | metric value (uint64_t) |
name | metric name |
o2::monitoring::Metric::Metric | ( | const std::string & | name, |
Verbosity | verbosity = Metric::DefaultVerbosity , |
||
const std::chrono::time_point< std::chrono::system_clock > & | timestamp = Metric::getCurrentTimestamp() |
||
) |
Constructor that does not require any value to be specified, .addValue needs to be used
name | metric name |
Metric && o2::monitoring::Metric::addTag | ( | tags::Key | key, |
tags::Value | value | ||
) |
Add user defined tags
key | enum tag key |
value | emum tag value |
Metric&& o2::monitoring::Metric::addTag | ( | tags::Key | key, |
unsigned short int | number | ||
) |
Add user defined tags
key | enum tag key |
value | numeric value |
Metric && o2::monitoring::Metric::addValue | ( | int | value, |
const std::string & | name | ||
) |
Adds additional int value to metric
value | |
name |
Metric && o2::monitoring::Metric::addValue | ( | double | value, |
const std::string & | name | ||
) |
Adds additional double value to metric
value | |
name |
Metric && o2::monitoring::Metric::addValue | ( | uint64_t | value, |
const std::string & | name | ||
) |
Adds additional uint64_t value to metric
value | |
name |
Metric && o2::monitoring::Metric::addValue | ( | std::string | value, |
const std::string & | name | ||
) |
Adds additional string value to metric
value | |
name |
Metric && o2::monitoring::Metric::addValue | ( | const std::variant< int, std::string, double, uint64_t > & | value, |
const std::string & | name | ||
) |
Adds additional variant value to metric
value | |
name |
|
static |
Generetes current timestamp return timestamp as std::chrono::system_clock
const std::pair< std::string, std::variant< int, std::string, double, uint64_t > > & o2::monitoring::Metric::getFirstValue | ( | ) | const |
First value getter
const std::string & o2::monitoring::Metric::getName | ( | ) | const |
Name getter
const std::vector< std::pair< int, int > > & o2::monitoring::Metric::getTags | ( | ) | const |
Tag list getter
std::chrono::time_point< std::chrono::system_clock > o2::monitoring::Metric::getTimestamp | ( | ) | const |
Timestamp getter
const std::vector< std::pair< std::string, std::variant< int, std::string, double, uint64_t > > > & o2::monitoring::Metric::getValues | ( | ) | const |
Values getter