Spaces:
Sleeping
Sleeping
Download tests/runtime/test_metrics.py from JeCabrera/open-cortex: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/spaces/JeCabrera/open-cortex/resolve/main/tests/runtime/test_metrics.py
- Command line
-
hf download hf://spaces/JeCabrera/open-cortex/tests/runtime/test_metrics.py
-
curl -L -o test_metrics.py https://huggingface.co/spaces/JeCabrera/open-cortex/resolve/main/tests/runtime/test_metrics.py
584 Bytes
| from open_cortex.runtime.metrics import parse_prometheus_value | |
| def test_parse_prometheus_value_reads_single_metric(): | |
| text = """ | |
| # HELP llamacpp:requests_processing Number of requests processing. | |
| # TYPE llamacpp:requests_processing gauge | |
| llamacpp:requests_processing 1 | |
| """ | |
| value = parse_prometheus_value(text, "llamacpp:requests_processing") | |
| assert value == 1.0 | |
| def test_parse_prometheus_value_returns_none_when_missing(): | |
| text = "llamacpp:requests_processing 1\n" | |
| value = parse_prometheus_value(text, "llamacpp:requests_deferred") | |
| assert value is None |