AnyCollect
1.1.2
|
Class used to represent a matcher, that is a way to convert expressions matches into a metric. More...
#include <Matcher.h>
Public Member Functions | |
Matcher () noexcept | |
Construct a new Matcher object. More... | |
Matcher (const Config::expression::metric &config) noexcept | |
Construct a new Matcher object. More... | |
const std::vector< std::string > & | name () const noexcept |
Returns the pattern for the name of the metric. More... | |
const std::string & | value () const noexcept |
Returns the pattern for the value of the metric. More... | |
const std::string & | unit () const noexcept |
Returns the pattern for the unit of the metric. More... | |
const std::map< std::string, std::string > & | tags () const noexcept |
Returns the pattern for the tags of the metric. More... | |
bool | computeRate () const noexcept |
Returns whether the metric is a rate. More... | |
bool | convertToUnitsPerSecond () const noexcept |
Returns whether the metric should be converted to units per second. More... | |
void | setName (const std::vector< std::string > &name) noexcept |
Sets the pattern for the name of the metric. More... | |
void | setValue (const std::string &value) noexcept |
Sets the pattern for the value of the metric. More... | |
void | setUnit (const std::string &unit) noexcept |
Sets the pattern for the unit of the metric. More... | |
void | setTags (const std::map< std::string, std::string > &tags) noexcept |
Sets the pattern for the tags of the metric. More... | |
void | setComputeRate (bool computeRate) noexcept |
Sets whether the metric is a rate. More... | |
void | setConvertToUnitsPerSecond (bool convertToUnitsPerSecond) noexcept |
Sets whether the metric should be converted to units per second. More... | |
std::optional< std::vector< std::string > > | getName (const std::cmatch &match, const std::vector< std::string > &pathParts) const noexcept |
Use an expression match to compute the metric's name. More... | |
std::optional< double > | getValue (const std::cmatch &match, const std::vector< std::string > &pathParts) const noexcept |
Use an expression match to compute the metric's value. More... | |
std::optional< std::string > | getUnit (const std::cmatch &match, const std::vector< std::string > &pathParts) const noexcept |
Use an expression match to compute the metric's unit. More... | |
std::optional< std::map< std::string, std::string > > | getTags (const std::cmatch &match, const std::vector< std::string > &pathParts) const noexcept |
Use an expression match to compute the metric's tags. More... | |
std::optional< Metric > | getMetric (const std::cmatch &match, const std::vector< std::string > &pathParts) const noexcept |
Use an expression match to compute the metric. More... | |
Static Public Attributes | |
static constexpr char | matchEscapeChar = '\\' |
Escape character. More... | |
static constexpr char | matchSubstitutionPrefix = '$' |
Variables prefix character. More... | |
static constexpr std::string_view | matchSubstitutionPathPrefix = "path_"sv |
Path part prefix variable string. More... | |
Protected Attributes | |
std::vector< std::string > | name_ |
Pattern for the name of the metric. More... | |
std::string | value_ |
Pattern for the value of the metric. More... | |
std::string | unit_ |
Pattern for the unit of the metric. More... | |
std::map< std::string, std::string > | tags_ |
Pattern for the tags of the metric. More... | |
bool | computeRate_ |
Whether the metric is a rate. More... | |
bool | convertToUnitsPerSecond_ |
Whether the metric should be converted to units per second. More... | |
Class used to represent a matcher, that is a way to convert expressions matches into a metric.
|
noexcept |
Construct a new Matcher object.
Definition at line 29 of file Matcher.cc.
|
noexcept |
Construct a new Matcher object.
config | configuration to use |
Definition at line 31 of file Matcher.cc.
|
noexcept |
Returns whether the metric is a rate.
Definition at line 57 of file Matcher.cc.
|
noexcept |
Returns whether the metric should be converted to units per second.
Definition at line 61 of file Matcher.cc.
|
noexcept |
Use an expression match to compute the metric.
match | expression match to use |
pathParts | parts of the source file's path, if any |
std::optional
if any of its fields couldn't be matched Definition at line 193 of file Matcher.cc.
|
noexcept |
Use an expression match to compute the metric's name.
match | expression match to use |
pathParts | parts of the source file's path, if any |
std::optional
if it couldn't be matched Definition at line 152 of file Matcher.cc.
|
noexcept |
Use an expression match to compute the metric's tags.
match | expression match to use |
pathParts | parts of the source file's path, if any |
std::optional
if it couldn't be matched Definition at line 178 of file Matcher.cc.
|
noexcept |
Use an expression match to compute the metric's unit.
match | expression match to use |
pathParts | parts of the source file's path, if any |
std::optional
if it couldn't be matched Definition at line 172 of file Matcher.cc.
|
noexcept |
Use an expression match to compute the metric's value.
match | expression match to use |
pathParts | parts of the source file's path, if any |
std::optional
if it couldn't be matched Definition at line 162 of file Matcher.cc.
|
noexcept |
Returns the pattern for the name of the metric.
Definition at line 41 of file Matcher.cc.
|
noexcept |
Sets whether the metric is a rate.
Definition at line 82 of file Matcher.cc.
|
noexcept |
Sets whether the metric should be converted to units per second.
Definition at line 86 of file Matcher.cc.
|
noexcept |
Sets the pattern for the name of the metric.
Definition at line 66 of file Matcher.cc.
|
noexcept |
Sets the pattern for the tags of the metric.
Definition at line 78 of file Matcher.cc.
|
noexcept |
Sets the pattern for the unit of the metric.
Definition at line 74 of file Matcher.cc.
|
noexcept |
Sets the pattern for the value of the metric.
Definition at line 70 of file Matcher.cc.
|
noexcept |
Returns the pattern for the tags of the metric.
Definition at line 53 of file Matcher.cc.
|
noexcept |
Returns the pattern for the unit of the metric.
Definition at line 49 of file Matcher.cc.
|
noexcept |
Returns the pattern for the value of the metric.
Definition at line 45 of file Matcher.cc.
|
protected |
|
protected |
|
static |
|
static |
|
static |
|
protected |
|
protected |
|
protected |
|
protected |