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  Histogram
 Represents the value of a HIST_RATE (a.k.a. More...
class  Metric
 Metric type that contains the labels: dict[str, str] and value: int. More...
class  _MetricsJSONEncoder
class  MetricsSnapshot
 Snapshot of captured metrics that mimics the dict interface. More...

Functions

bool _type_eq (MetricType lhs, MetricType rhs)
tuple[tuple[str, str],...] _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 (Any value)
_FlattenedSnapshot _flatten_snapshot (values, bool ignore_zeros)
str _diff_metric_snapshots (_FlattenedSnapshot lhs, _FlattenedSnapshot rhs, bool ignore_zeros)

Variables

TypeAlias _FlattenedSnapshot = Set[tuple[str, Metric]]

Function Documentation

◆ _diff_metric_snapshots()

str _diff_metric_snapshots ( _FlattenedSnapshot lhs,
_FlattenedSnapshot rhs,
bool ignore_zeros )
protected

Definition at line 411 of file metrics.py.

◆ _do_compute_percentile()

float _do_compute_percentile ( Histogram hist,
float percent )
protected

Definition at line 362 of file metrics.py.

◆ _flatten_snapshot()

_FlattenedSnapshot _flatten_snapshot ( values,
bool ignore_zeros )
protected

Definition at line 402 of file metrics.py.

◆ _get_labels_tuple()

tuple[tuple[str, str], ...] _get_labels_tuple ( Metric metric)
protected

Returns labels as a tuple of sorted items.

Definition at line 357 of file metrics.py.

◆ _parse_metric_value()

MetricValue _parse_metric_value ( Any value)
protected

Definition at line 384 of file metrics.py.

◆ _type_eq()

bool _type_eq ( MetricType lhs,
MetricType rhs )
protected

Definition at line 353 of file metrics.py.

Variable Documentation

◆ _FlattenedSnapshot

TypeAlias pytest_userver.metrics._FlattenedSnapshot = Set[tuple[str, Metric]]
protected

Definition at line 399 of file metrics.py.