userver: pytest_userver.metrics Namespace Reference
Loading...
Searching...
No Matches
pytest_userver.metrics Namespace Reference

Detailed Description

Python module that provides helpers for functional testing of metrics with testsuite; see Functional service tests (testsuite) for an introduction.

Classes

class  _MetricsJSONEncoder
 
class  Histogram
 Represents the value of a HIST_RATE (a.k.a. More...
 
class  Metric
 Metric type that contains the labels: typing.Dict[str, str] and value: int. More...
 
class  MetricsSnapshot
 Snapshot of captured metrics that mimics the dict interface. More...
 

Functions

bool _type_eq (MetricType lhs, MetricType rhs)
 
typing.Tuple _get_labels_tuple (Metric metric)
 Returns labels as a tuple of sorted items.
 
float _do_compute_percentile (Histogram hist, float percent)
 
MetricValue _parse_metric_value (typing.Any value)
 
_FlattenedSnapshot _flatten_snapshot (values, bool ignore_zeros)
 
str _diff_metric_snapshots (_FlattenedSnapshot lhs, _FlattenedSnapshot rhs, bool ignore_zeros)
 

Variables

 MetricValue = typing.Union[float, Histogram]
 
 _FlattenedSnapshot = typing.Set[typing.Tuple[str, Metric]]
 

Function Documentation

◆ _diff_metric_snapshots()

str pytest_userver.metrics._diff_metric_snapshots ( _FlattenedSnapshot lhs,
_FlattenedSnapshot rhs,
bool ignore_zeros )
protected

Definition at line 434 of file metrics.py.

◆ _do_compute_percentile()

float pytest_userver.metrics._do_compute_percentile ( Histogram hist,
float percent )
protected

Definition at line 387 of file metrics.py.

◆ _flatten_snapshot()

_FlattenedSnapshot pytest_userver.metrics._flatten_snapshot ( values,
bool ignore_zeros )
protected

Definition at line 425 of file metrics.py.

◆ _get_labels_tuple()

typing.Tuple pytest_userver.metrics._get_labels_tuple ( Metric metric)
protected

Returns labels as a tuple of sorted items.

Definition at line 382 of file metrics.py.

◆ _parse_metric_value()

MetricValue pytest_userver.metrics._parse_metric_value ( typing.Any value)
protected

Definition at line 409 of file metrics.py.

◆ _type_eq()

bool pytest_userver.metrics._type_eq ( MetricType lhs,
MetricType rhs )
protected

Definition at line 374 of file metrics.py.

Variable Documentation

◆ _FlattenedSnapshot

pytest_userver.metrics._FlattenedSnapshot = typing.Set[typing.Tuple[str, Metric]]
protected

Definition at line 422 of file metrics.py.

◆ MetricValue

pytest_userver.metrics.MetricValue = typing.Union[float, Histogram]

Definition at line 66 of file metrics.py.