6 #ifndef ALICEO2_MONITORING_CORE_METRIC_H 7 #define ALICEO2_MONITORING_CORE_METRIC_H 67 Metric&& addValue(
int value,
const std::string& name);
72 Metric&& addValue(
double value,
const std::string& name);
77 Metric&& addValue(uint64_t value,
const std::string& name);
82 Metric&& addValue(std::string value,
const std::string& name);
87 Metric&& addValue(
const std::variant<int, std::string, double, uint64_t>& value,
const std::string& name);
94 const std::string& getName()
const;
98 std::chrono::time_point<std::chrono::system_clock> getTimestamp()
const;
102 const std::vector<std::pair<std::string, std::variant<int, std::string, double, uint64_t>>>& getValues()
const;
106 const std::pair<std::string, std::variant<int, std::string, double, uint64_t>>& getFirstValue()
const;
109 std::size_t getValuesSize()
const noexcept;
113 const std::vector<std::pair<int, int>>& getTags()
const;
119 Metric&& addTag(tags::Key key, tags::Value value);
125 Metric&& addTag(tags::Key key,
unsigned short int number);
132 static auto getCurrentTimestamp() -> decltype(std::chrono::system_clock::now());
135 static void setDefaultVerbosity(
Verbosity verbosity);
141 static void setVerbosityPolicy(
Verbosity verbosity,
const std::regex& regex);
147 int getFirstValueType()
const;
154 Metric&& setTags(std::vector<std::pair<int, int>>&& tags);
157 std::vector<std::pair<std::string, std::variant<int, std::string, double, uint64_t>>>
mValues;
163 std::chrono::time_point<std::chrono::system_clock>
mTimestamp;
166 std::vector<std::pair<int, int>>
mTags;
172 static std::map<std::underlying_type<Verbosity>::type, std::regex>
mRegexPolicy;
175 void overwriteVerbosity();
178 static constexpr
char mDefaultValueName[] =
"value";
184 #endif // ALICEO2_MONITORING_CORE_METRIC_H static auto getCurrentTimestamp() -> decltype(std::chrono::system_clock::now())
Definition: Metric.cxx:137
std::string mName
Metric name.
Definition: Metric.h:160
std::vector< std::pair< int, int > > mTags
Metric tags.
Definition: Metric.h:166
MetricType
Metric types.
Definition: Metric.h:29
static bool includeTimestamp
Whether timestamp should be included or not.
Definition: Metric.h:144
Verbosity
Metric and Backedn verbosity.
Definition: Metric.h:24
Enables Calculation of derived metrics.
Definition: DerivedMetrics.h:41
Represents a metric including value, type of the value, name, timestamp and tags. ...
Definition: Metric.h:37
static std::map< std::underlying_type< Verbosity >::type, std::regex > mRegexPolicy
Regex policy map.
Definition: Metric.h:172
static Verbosity DefaultVerbosity
Default metric verbosity.
Definition: Metric.h:138
std::chrono::time_point< std::chrono::system_clock > mTimestamp
Metric timestamp.
Definition: Metric.h:163
Verbosity mVerbosity
Metric verbosity.
Definition: Metric.h:169
std::vector< std::pair< std::string, std::variant< int, std::string, double, uint64_t > > > mValues
Metric values.
Definition: Metric.h:157