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 | Provenance | Actions |
|---|---|---|---|---|
| py_metric_support-0.4.0.tar.gz | 11.3 kB | Without provenance | Details for py_metric_support-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_metric_support-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for py_metric_support-0.4.0-py3-none-any.whl |
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
|
Security for py-metric-support 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.