#include <userver/utils/statistics/testing.hpp>
A snapshot of metrics from utils::statistics::Storage.
Definition at line 32 of file testing.hpp.
Public Member Functions | |
Snapshot (const Storage &storage, std::string prefix={}, std::vector< Label > require_labels={}) | |
Create a new snapshot of metrics with paths starting with prefix and labels containing require_labels. | |
Snapshot (const Snapshot &other)=default | |
Snapshot (Snapshot &&other) noexcept=default | |
MetricValue | SingleMetric (std::string path, std::vector< Label > require_labels={}) const |
Find a single metric by the given filter. | |
std::optional< MetricValue > | SingleMetricOptional (std::string path, std::vector< Label > require_labels={}) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
|
explicit |
Create a new snapshot of metrics with paths starting with prefix and labels containing require_labels.
std::exception | if a metric writer throws. |
MetricValue utils::statistics::Snapshot::SingleMetric | ( | std::string | path, |
std::vector< Label > | require_labels = {} ) const |
Find a single metric by the given filter.
path | The path of the target metric. prefix specified in the constructor is prepended to the path. |
require_labels | Labels that the target metric should have. |
MetricQueryError | if none or multiple metrics are found. |
Support for gtest diagnostics for utils::statistics::Snapshot.
Valid usage:
Invalid usage: