py_metric_support
Prometheus metric helper.
Install
pip install -e .
Or with requirements files:
pip install -r requirements.txt
pip install -r requirements-dev.txt
Usage
from py_metric_support import Measure, MetricSupport
MetricSupport.counter("requests_total", ("path", "/health")).inc()
MetricSupport.gauge("workers").set(4)
MetricSupport.gauge_on_scrape("build_info", "version", callback=lambda: Measure(1, "0.1.0"))
MetricSupport.summary("request_latency_seconds", ("path", "/health"), quantiles=[0.5, (0.95, 0.01)]).observe(0.123)
print(MetricSupport.to_prometheus())
print(MetricSupport.to_json_string())
quantiles= accepts either raw ranks like 0.5 or (rank, precision) pairs like (0.95, 0.01).
When quantiles are requested, py_metric_support uses the prometheus-summary backend because the official Python Prometheus client exports _sum and _count only.
Metadata
Release files for py-metric-support 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_metric_support-0.4.0.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_metric_support-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / py_metric_support-0.4.0.tar.gz
| Download URL | py_metric_support-0.4.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
237e825d6f10b998dbc63cf1e3ae346a1b569fa4be59b8821a082c4389bb73f2
|
|
BLAKE2b-256 checksum How to use checksums |
6e3a1d9133597a4292b257de4fe4503c9c46c957ad132342332893b8c7b1d485
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / py_metric_support-0.4.0-py3-none-any.whl
| Download URL | py_metric_support-0.4.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40c3d177f71066c7ffcf65d7993c8284a2a2a3df55250eb09dddde2fef2ef1fb
|
|
BLAKE2b-256 checksum How to use checksums |
bba3c9f143cb6147b4425d83b5025b372129f85e6ad520c156dfe6e0414ae55d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|