--- id: prometheus-async version: "26.1.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # prometheus-async — Async helpers for prometheus_client. License: permissive · Maintenance: active · Downloads: 253.2K/mo ## 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 above — 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 pip install prometheus-async uv add prometheus-async 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_current - Install friction: low - Maintenance: active - Downloads: 253.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags prometheus async metrics, asyncio prometheus client, twisted prometheus integration, async metric collection, prometheus-client asyncio wrapper, async monitoring prometheus, prometheus async decorators, async-metrics, prometheus-integration, monitoring [View on SkillFed](https://skillfed.io/packages/prometheus-async) · [View on PyPI](https://pypi.org/project/prometheus-async/)