#include <userver/utils/statistics/request.hpp>
Class describing the request for metrics data.
Metric path and metric name are the same thing. For example for code like
the metric name is "a.b.c" and in Prometheus format it would be escaped like "a_b_c{} 42".
add_labels should not match labels from Storage, otherwise the returned metrics may not be read by metrics server. Definition at line 30 of file request.hpp.
Public Types | |
| enum class | PrefixMatch { kNoop , kExact , kStartsWith } |
Enum for different match types of the prefix More... | |
| using | AddLabels = std::unordered_map< std::string, std::string > |
Public Member Functions | |
| Request ()=default | |
Static Public Member Functions | |
| static Request | MakeWithPrefix (const std::string &prefix, AddLabels add_labels={}, std::vector< Label > require_labels={}) |
Makes request for metrics whose path starts with the prefix. | |
| static Request | MakeWithPath (const std::string &path, AddLabels add_labels={}, std::vector< Label > require_labels={}) |
Makes request for metrics whose path is path. | |
Public Attributes | |
| const std::string | prefix {} |
Return metrics whose path matches with this prefix | |
| const PrefixMatch | prefix_match_type = PrefixMatch::kNoop |
Match type of the prefix | |
| const std::vector< Label > | require_labels {} |
| Require those labels in the metric. | |
| const AddLabels | add_labels {} |
| Add those labels to each returned metric. | |
| using utils::statistics::Request::AddLabels = std::unordered_map<std::string, std::string> |
Definition at line 32 of file request.hpp.
|
strong |
Enum for different match types of the prefix
| Enumerator | |
|---|---|
| kNoop | Do not match, the |
| kExact |
|
| kStartsWith | Metric path starts with |
Definition at line 56 of file request.hpp.
|
default |
Default request without parameters. Equivalent to requesting all the metrics without adding or requiring any labels.
| const AddLabels utils::statistics::Request::add_labels {} |
Add those labels to each returned metric.
Definition at line 69 of file request.hpp.
| const std::string utils::statistics::Request::prefix {} |
Return metrics whose path matches with this prefix
Definition at line 53 of file request.hpp.
| const PrefixMatch utils::statistics::Request::prefix_match_type = PrefixMatch::kNoop |
Match type of the prefix
Definition at line 63 of file request.hpp.
Require those labels in the metric.
Definition at line 66 of file request.hpp.