Skip to main content

Prombed Python

The Python implementation provides zero-runtime-dependency Prometheus text exposition parsing, bounded in-memory storage, static-target scraping, and PromQL queries. It requires Python 3.10+.

Development

cd <repo_root>/python
uv sync --extra dev
uv run pytest -q
uv run ruff format .
uv run ruff check .

API

from prombed import Prombed, ScrapeTarget

metrics = Prombed(
    targets=[
        ScrapeTarget(
            "http://example:8080/metrics",
            labels={"service": "example"},
            metric_names=("example_requests_total", "example_duration_seconds"),
        )
    ],
    retention_ms=10 * 60_000,
    scrape_interval_ms=5_000,
)

await metrics.start()
success_rate = metrics.query(
    'sum(rate(example_requests_total{status="success"}[1m])) '
    "/ sum(rate(example_requests_total[1m]))"
)
latency = metrics.query(
    "histogram_quantile(0.95, sum by (le) (rate(example_duration_seconds_bucket[1m])))"
)
metrics.stop()
  • await scrape_once() scrapes configured targets immediately.
  • await start() performs an initial scrape and starts periodic collection; stop() stops it.
  • ingest() accepts a snapshot when the caller owns the sampling lifecycle.
  • targets() returns target health and the latest scrape error.
  • query() and query_range() return Prometheus HTTP API-style dictionaries.

Storage, queries, and external requests have explicit capacity and timeout limits. See the PromQL compatibility contract for supported behavior and deliberate omissions.

Metadata

Release files for prombed 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prombed 0.1.0
File Size Uploaded Provenance
prombed-0.1.0.tar.gz 31.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for prombed 0.1.0
File Interpreter ABI Platform
prombed-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.1 kB

Release files / prombed-0.1.0.tar.gz

Download URL prombed-0.1.0.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0f22a191614274ff79631b7e6d51df6ed9a54879be081a988fbc49cec05373ae
BLAKE2b-256 checksum
How to use checksums
607874ef65fcf1e2c31330686c5dea430a2adf6140ccb32f12003ed22a562900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / prombed-0.1.0-py3-none-any.whl

Download URL prombed-0.1.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28b2ba82b958d13b1759c30aab5a2d7de0dd09b183942a5126f069cbc046a080
BLAKE2b-256 checksum
How to use checksums
43bf16761998ba13bc66c01f71c404f54d86dcd4926d8c9024f2435ec06096d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Security for prombed 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page