userver: pytest_userver.client.MetricsDiffer Class Reference
Loading...
Searching...
No Matches
pytest_userver.client.MetricsDiffer Class Reference

Detailed Description

A helper class for computing metric differences.

See also
ClientMonitor.metrics_diff

Definition at line 550 of file client.py.

Public Member Functions

metric_module.MetricsSnapshot baseline (self)
 
None baseline (self, metric_module.MetricsSnapshot value)
 
metric_module.MetricsSnapshot current (self)
 
None current (self, metric_module.MetricsSnapshot value)
 
metric_module.MetricsSnapshot diff (self)
 
metric_module.MetricValue value_at (self, str|None subpath=None, dict[str, str]|None add_labels=None, *, float|None default=None)
 Returns a single metric value at the specified path, prepending the path provided at construction.
 
metric_module.MetricsSnapshot fetch (self)
 Fetches metric values from the service.
 
MetricsDiffer __aenter__ (self)
 
None __aexit__ (self, exc_type, exc, exc_tb)
 

Public Attributes

metric_module.MetricsSnapshot current = await self.fetch()
 

Protected Attributes

metric_module.MetricsSnapshot _baseline = value
 
 _diff
 
 _current = value
 

Member Function Documentation

◆ __aenter__()

MetricsDiffer pytest_userver.client.MetricsDiffer.__aenter__ ( self)

Definition at line 654 of file client.py.

◆ __aexit__()

None pytest_userver.client.MetricsDiffer.__aexit__ ( self,
exc_type,
exc,
exc_tb )

Definition at line 659 of file client.py.

◆ baseline() [1/2]

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer.baseline ( self)

Definition at line 579 of file client.py.

◆ baseline() [2/2]

None pytest_userver.client.MetricsDiffer.baseline ( self,
metric_module.MetricsSnapshot value )

Definition at line 584 of file client.py.

◆ current() [1/2]

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer.current ( self)

Definition at line 594 of file client.py.

◆ current() [2/2]

None pytest_userver.client.MetricsDiffer.current ( self,
metric_module.MetricsSnapshot value )

Definition at line 599 of file client.py.

◆ diff()

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer.diff ( self)

Definition at line 609 of file client.py.

◆ fetch()

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer.fetch ( self)

Fetches metric values from the service.

Definition at line 644 of file client.py.

◆ value_at()

metric_module.MetricValue pytest_userver.client.MetricsDiffer.value_at ( self,
str | None subpath = None,
dict[str, str] | None add_labels = None,
* ,
float | None default = None )

Returns a single metric value at the specified path, prepending the path provided at construction.

If a dict of labels is provided, does en exact match of labels, prepending the labels provided at construction.

Parameters
subpathSuffix of the metric path; the path provided at construction is prepended
add_labelsLabels that the metric must have in addition to the labels provided at construction
defaultAn optional default value in case the metric is missing
Exceptions
AssertionErrorif not one metric by path

Definition at line 613 of file client.py.

Member Data Documentation

◆ _baseline

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer._baseline = value
protected

Definition at line 585 of file client.py.

◆ _current

pytest_userver.client.MetricsDiffer._current = value
protected

Definition at line 600 of file client.py.

◆ _diff

pytest_userver.client.MetricsDiffer._diff
protected
Initial value:
= _subtract_metrics_snapshots(
self._current,
self._baseline,
self._diff_gauge,
)

Definition at line 587 of file client.py.

◆ current

metric_module.MetricsSnapshot pytest_userver.client.MetricsDiffer.current = await self.fetch()

Definition at line 660 of file client.py.


The documentation for this class was generated from the following file: