Asyncio userver client for monitor listeners, typically retrieved from plugins.service_client.monitor_client fixture.
Compatible with werkzeug interface.
Definition at line 373 of file client.py.
|
'MetricsDiffer' | metrics_diff (self, *typing.Optional[str] path=None, typing.Optional[str] prefix=None, typing.Optional[typing.Dict[str, str]] labels=None, bool diff_gauge=False) |
| Creates a MetricsDiffer that fetches metrics using this client.
|
|
metric_module.MetricsSnapshot | metrics (self, *typing.Optional[str] path=None, typing.Optional[str] prefix=None, typing.Optional[typing.Dict[str, str]] labels=None) |
| Returns a dict of metric names to Metric.
|
|
typing.Optional[Metric] | single_metric_optional (self, str path, *typing.Optional[typing.Dict[str, str]] labels=None) |
| Either return a Metric or None if there's no such metric.
|
|
typing.Optional[Metric] | single_metric (self, str path, *typing.Optional[typing.Dict[str, str]] labels=None) |
| Returns the Metric.
|
|
typing.Dict[str, Metric] | metrics_raw (self, str output_format, *typing.Optional[str] path=None, typing.Optional[str] prefix=None, typing.Optional[typing.Dict[str, str]] labels=None) |
| Low level function that returns metrics in a specific format.
|
|
| get_metrics (self, prefix=None) |
|
| get_metric (self, metric_name) |
|
| fired_alerts (self) |
|
'MetricsDiffer' pytest_userver.client.ClientMonitor.metrics_diff |
( |
| self, |
|
|
*typing.Optional[str] | path = None, |
|
|
typing.Optional[str] | prefix = None, |
|
|
typing.Optional[typing.Dict[str, str]] | labels = None, |
|
|
bool | diff_gauge = False ) |
Creates a MetricsDiffer
that fetches metrics using this client.
It's recommended to use this method over metrics
to make sure the tests don't affect each other.
With diff_gauge
off, only RATE metrics are differentiated. With diff_gauge
on, GAUGE metrics are differentiated as well, which may lead to nonsensical results for those.
- Parameters
-
path | Optional full metric path |
prefix | Optional prefix on which the metric paths should start |
labels | Optional dictionary of labels that must be in the metric |
diff_gauge | Whether to differentiate GAUGE metrics |
async with monitor_client.metrics_diff(prefix='foo') as differ:
assert differ.value_at('path-suffix', {'label'}) == 42
Definition at line 383 of file client.py.