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 on Python 3.7 and later 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.

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-22.1.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

prometheus_async-22.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file prometheus-async-22.1.0.tar.gz.

File metadata

  • Download URL: prometheus-async-22.1.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for prometheus-async-22.1.0.tar.gz
Algorithm Hash digest
SHA256 2abdf0ffd419aa9889b375b0dd5af4cb5708457a0b19ae21d3968fea68c3faf3
MD5 863c7fbe99828d143e7523db7a5c7be8
BLAKE2b-256 4fb815c220e7849b9806b9f2dbb6692336471f01db1b52e778286e3d7ef3cf89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prometheus_async-22.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for prometheus_async-22.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 debd4b0a9e963f3118890c1164423b273b3b6c6a746521b925a2e5b5ab8cd96f
MD5 b591230a7b1be78cce396e2b85f8e131
BLAKE2b-256 5b84ef90681f5e01c32175cf1e6457a7e714f2b40023ef6444feb0069975025f

See more details on using hashes here.

Supported by

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