You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ``log_metric`` fixture is a powerful tool for recording performance metrics or other numerical data during your tests. It generates a file that follows the Prometheus text-based format, which is highly compatible with modern monitoring systems and the OpenMetrics standard.
6
+
7
+
**********
8
+
Use Case
9
+
**********
10
+
11
+
You can use this fixture to track key metrics from your embedded device, such as boot time, memory usage, or network throughput. By logging these values, you can monitor performance trends over time and catch regressions automatically.
12
+
13
+
**************
14
+
CLI Argument
15
+
**************
16
+
17
+
To enable metric logging, you need to provide the ``--metric-path`` command-line argument. This specifies the file where the metrics will be saved.
18
+
19
+
.. code:: bash
20
+
21
+
pytest --metric-path=output/metrics.txt
22
+
23
+
***************
24
+
Fixture Usage
25
+
***************
26
+
27
+
To use the fixture, simply include ``log_metric`` as an argument in your test function. It provides a callable that you can use to log your metrics.
0 commit comments