Skip to main content

Async helpers for prometheus_client.

Project description

PyPI Documentation Status CI status Test Coverage Code style: black

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

Currently asyncio (Python 3.5+, PyPy3) and Twisted (Python 2.7, 3.5+, PyPy) 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 for the time being).

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

Release Information

18.3.0 (2018-06-21)

Backward-incompatible changes:

none

Deprecations:

none

Changes:

  • The HTTP access log when using prometheus_async.start_http_server() is disabled now. It was activated accidentally when moving to aiohttp’s application runner APIs.

Full changelog.

Credits

prometheus_async is written and maintained by Hynek Schlawack.

The development is kindly supported by Variomedia AG.

Other contributors can be found in GitHub’s overview.

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

Uploaded Source

Built Distribution

prometheus_async-18.3.0-py2.py3-none-any.whl (16.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for prometheus_async-18.3.0.tar.gz
Algorithm Hash digest
SHA256 18195f65983496a5ead6ff13a5c0ae1cc8e9ae231be26b8505696890e92ffd6c
MD5 a506205b200767ee11ab89b2f3b8d829
BLAKE2b-256 95272e3f8939f2022f7de39f2bcbdbb7d0426d508825ee400ad62b3501c06286

See more details on using hashes here.

File details

Details for the file prometheus_async-18.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for prometheus_async-18.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8e6e8d2ca7ef4f744e0633c39490146646a51e366e105f6f52e4aeee47953bd9
MD5 b8659c6bdc94a2f5d9aae0b191c981b2
BLAKE2b-256 b28979fc07e1b8abb9712b710d904203ccb47249ee75aa0953921722e77bb21f

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