Your opinion will help to improve our service
Leave a feedback >Asyncio userver client for monitor listeners, typically retrieved from plugins.service_client.monitor_client fixture.
Compatible with werkzeug interface.
Public Member Functions | |
'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) | |
http.ClientResponse | post (self, str path, JsonAnyOptional json=None, typing.Any data=None, typing.Optional[typing.Dict[str, str]] params=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, typing.Optional[typing.Dict[str, str]] headers=None, **kwargs) |
Make a HTTP POST request. | |
http.ClientResponse | put (self, path, JsonAnyOptional json=None, typing.Any data=None, typing.Optional[typing.Dict[str, str]] params=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, typing.Optional[typing.Dict[str, str]] headers=None, **kwargs) |
Make a HTTP PUT request. | |
http.ClientResponse | patch (self, path, JsonAnyOptional json=None, typing.Any data=None, typing.Optional[typing.Dict[str, str]] params=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, typing.Optional[typing.Dict[str, str]] headers=None, **kwargs) |
Make a HTTP PATCH request. | |
http.ClientResponse | get (self, str path, typing.Optional[typing.Dict[str, str]] headers=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, **kwargs) |
Make a HTTP GET request. | |
http.ClientResponse | delete (self, str path, typing.Optional[typing.Dict[str, str]] headers=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, **kwargs) |
Make a HTTP DELETE request. | |
http.ClientResponse | options (self, str path, typing.Optional[typing.Dict[str, str]] headers=None, typing.Optional[str] bearer=None, typing.Optional[str] x_real_ip=None, **kwargs) |
Make a HTTP OPTIONS request. | |
http.ClientResponse | request (self, str http_method, str path, **kwargs) |
Make a HTTP request with the specified method. | |
raw_aiohttp_client (self) | |
Protected Member Functions | |
typing.Awaitable[http.ClientResponse] | _wrap_client_response (self, aiohttp.ClientResponse response) |
Protected Attributes | |
_client = client | |
|
protectedinherited |
|
inherited |
|
inherited |
pytest_userver.client.ClientMonitor.get_metric | ( | self, | |
metric_name ) |
pytest_userver.client.ClientMonitor.get_metrics | ( | self, | |
prefix = None ) |
metric_module.MetricsSnapshot pytest_userver.client.ClientMonitor.metrics | ( | self, | |
* | , | ||
typing.Optional[str] | path = None, | ||
typing.Optional[str] | prefix = None, | ||
typing.Optional[typing.Dict[str, str]] | labels = None ) |
'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.
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 |
typing.Dict[str, Metric] pytest_userver.client.ClientMonitor.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.
Use metrics
and single_metric
instead if possible.
output_format | Metric output format. See server.handlers.ServerMonitor for a list of supported formats. |
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 |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
typing.Optional[Metric] pytest_userver.client.ClientMonitor.single_metric | ( | self, | |
str | path, | ||
* | , | ||
typing.Optional[typing.Dict[str, str]] | labels = None ) |
typing.Optional[Metric] pytest_userver.client.ClientMonitor.single_metric_optional | ( | self, | |
str | path, | ||
* | , | ||
typing.Optional[typing.Dict[str, str]] | labels = None ) |
|
protectedinherited |