Skip to main content

Async helpers for prometheus_client.

Project description

prometheus-async

Documentation License: Apache 2.0 No AI slop inside. PyPI version Downloads / Month

prometheus-async adds support for asynchronous frameworks to the official Python client for the Prometheus metrics and monitoring system.

Currently asyncio and Twisted are supported.

It works by wrapping the metrics from the official client:

import asyncio

from aiohttp import web
from prometheus_client import Histogram
from prometheus_async.aio import time

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

@time(REQ_TIME)
async def req(request):
      await asyncio.sleep(1)
      return web.Response(body=b"hello")

Even for synchronous applications, the metrics exposure methods can be useful since they are more powerful than the one shipped with the official client. For that, helper functions have been added that run them in separate threads (asyncio-only).

The source code is hosted on GitHub and the documentation on Read the Docs.

Credits

prometheus-async is written and maintained by Hynek Schlawack.

The development is kindly supported by my employer Variomedia AG, prometheus-async’s Tidelift subscribers, and all my amazing GitHub Sponsors.

prometheus-async for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of prometheus-async and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prometheus_async-26.1.0.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prometheus_async-26.1.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file prometheus_async-26.1.0.tar.gz.

File metadata

  • Download URL: prometheus_async-26.1.0.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prometheus_async-26.1.0.tar.gz
Algorithm Hash digest
SHA256 71b0868ed95ddb3bf8275b19e681f8730ac2a9a0e2df06923ebc4943dcc1b83b
MD5 d6ad0ac2718648801b2f4dc019d4558f
BLAKE2b-256 3a36b28785a5639095d889f04bf06bf0e89cb700a2766604f03f6445d0bac4ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_async-26.1.0.tar.gz:

Publisher: pypi-package.yml on hynek/prometheus-async

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prometheus_async-26.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_async-26.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde2ab74a5a7df2b9a93666d68bae4c760950e71f50786645d3b26e2cd749a36
MD5 3da7e8747cd6fd7bce7e58f07ea8adaa
BLAKE2b-256 27032b2a24228a5fef41fa727c83880efc097be318ba7e247d2243c222bba235

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_async-26.1.0-py3-none-any.whl:

Publisher: pypi-package.yml on hynek/prometheus-async

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page