Skip to main content

Async helpers for prometheus_client.

Project description

prometheus-async

Documentation License: Apache 2.0 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-25.1.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prometheus_async-25.1.0.tar.gz
Algorithm Hash digest
SHA256 968e29b5255af57bc8146ade132e7aa0a21fe2b4d95ffefc7c732e9c3fbbb1dd
MD5 3226e9af41264b3aee465276d556ac02
BLAKE2b-256 373870567994cce643dcd1845d52e8870d91e24b69f49f59381ed523c06d0650

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_async-25.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-25.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_async-25.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfa4d85fbbf3fc052a87c7a221a68d4a1d6bd39d31723ac935304dacaedaf69
MD5 da59d623b6c1f3a1e910f52eebefbaa6
BLAKE2b-256 f745ce7e7c879e7dbb1713f29a666e40285d3b25f7c431fa2c7a771aadc9183a

See more details on using hashes here.

Provenance

The following attestation bundles were made for prometheus_async-25.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 Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page