userver: pytest_userver.metrics.Metric Class Reference
Loading...
Searching...
No Matches
pytest_userver.metrics.Metric Class Reference

Metric type that contains the labels: typing.Dict[str, str] and value: int. More...

+ Collaboration diagram for pytest_userver.metrics.Metric:

Public Member Functions

int __hash__ (self)
 
typing.Tuple get_labels_tuple (self)
 Returns labels as a tuple of sorted items.
 

Static Public Attributes

typing labels .Dict[str, str]
 
float value
 

Detailed Description

Metric type that contains the labels: typing.Dict[str, str] and value: int.

The type is hashable and comparable:

# Checking for a particular metric
assert metrics.Metric({}, value=3) in values['sample']
# Comparing with a set of Metric
assert values['sample'] == {
metrics.Metric(labels={}, value=3),
metrics.Metric(labels={'label': 'b'}, value=2),
metrics.Metric(labels={'label': 'a'}, value=1),
}

Definition at line 15 of file metrics.py.

Member Function Documentation

◆ __hash__()

int pytest_userver.metrics.Metric.__hash__ (   self)

Definition at line 29 of file metrics.py.

◆ get_labels_tuple()

typing.Tuple pytest_userver.metrics.Metric.get_labels_tuple (   self)

Returns labels as a tuple of sorted items.

Definition at line 32 of file metrics.py.

Member Data Documentation

◆ labels

typing pytest_userver.metrics.Metric.labels .Dict[str, str]
static

Definition at line 26 of file metrics.py.

◆ value

float pytest_userver.metrics.Metric.value
static

Definition at line 27 of file metrics.py.


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