skillfed

prometheus-async

Async helpers for prometheus_client.

prometheus-async v26.1.0 253.2K downloads/30d#8,524 on PyPI185
Permissive license Apache-2.0 Active released

What it is and what it does

prometheus-async bridges the official Prometheus Python client and async frameworks by providing decorators and helpers that work with asyncio and Twisted. It lets you instrument async code paths with Prometheus metrics—timers, histograms, counters—using the same metric objects from prometheus-client, but with async-aware wrappers that don't block event loops.

The package is most useful for async web services and event-driven applications where you need to collect metrics without introducing synchronous bottlenecks. For synchronous applications, it also offers helper functions to expose metrics in separate threads. It depends on prometheus-client for the core metric types, typing-extensions for type hints, and wrapt for function wrapping.

Use it for:

  • Instrument async HTTP handlers in aiohttp or FastAPI with request timing and error counters.
  • Collect metrics from Twisted async applications without blocking the reactor.
  • Expose Prometheus metrics endpoints in async web services using thread-safe helpers.
  • Decorate async functions to automatically record execution time and call counts.
  • Monitor async task queues and background job systems in event-driven architectures.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds async/await support to Prometheus metrics collection for asyncio and Twisted applications, wrapping the official prometheus-client library.

Yes, if you run async applications and need Prometheus metrics. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real gap in the official client's async support. Skip it if you only use synchronous code or don't need Prometheus integration.

Install

prometheus-async on PyPI

pip

pip install prometheus-async

uv

uv add prometheus-async

poetry

poetry add prometheus-async

Installing prometheus-async

Before you install

Low install friction with three straightforward runtime dependencies. Actively maintained with a recent release and ongoing commits; marked Production/Stable and supports current Python versions.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions.

Quickstart

pip install prometheus-async

from prometheus_client import Histogram
from prometheus_async.aio import time
import asyncio

REQ_TIME = Histogram("req_time_seconds", "time spent in requests")

@time(REQ_TIME)
async def my_handler():
    await asyncio.sleep(1)
    return "done"

Requires Python 3.9 or later; asyncio support requires an async runtime (asyncio or Twisted).

Verify before relying

  • Whether the package's metric exposure methods for synchronous applications offer concrete advantages over prometheus-client's built-in methods beyond thread-based execution.
  • Performance characteristics and overhead of the async wrapper compared to direct prometheus-client usage.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 3 — prometheus-client, typing-extensions, wrapt
Maintenance actively maintained — 143 days since the last release
Last repo commit
First released
Downloads 253,190/month — #8,524 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: prometheus_async-26.1.0-py3-none-any.whl

Keywords: async, asyncio, metrics, prometheus, twisted

Development Status :: 5 - Production/StableProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Typing :: Typed

Tags

prometheus async metricsasyncio prometheus clienttwisted prometheus integrationasync metric collectionprometheus-client asyncio wrapperasync monitoring prometheusprometheus async decorators
async-metricsprometheus-integrationmonitoring

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

prometheus-client

Instruments Python applications to expose…

permissive · top 1,000 on PyPI

prometheus-client-python-speedups

Provides optional C/Rust-compiled speedups for…

unclear · top 15,000 on PyPI

py-grpc-prometheus

Adds Prometheus metrics collection to gRPC…

unclear · top 5,000 on PyPI

treq

treq is a high-level HTTP client library for…

permissive · top 15,000 on PyPI

django-prometheus

Exports Django application metrics (requests,…

permissive · top 5,000 on PyPI

prometheus-flask-exporter

Exports HTTP request metrics from Flask…

permissive · top 5,000 on PyPI

aioprometheus

A Prometheus client library for asyncio…

permissive · top 15,000 on PyPI

prometheus-api-client

Connects to Prometheus monitoring systems and…

permissive · top 5,000 on PyPI

prometheus-fastapi-instrumentator

Adds Prometheus metrics collection and exposure…

permissive · top 5,000 on PyPI

starlette-exporter

Collects and exports Prometheus metrics for…

permissive · top 5,000 on PyPI