Skip to main content

Async helpers for prometheus_client.

Project description

PyPI Documentation Status CI status Test Coverage

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.1.0 (2018-02-15)

Backward-incompatible changes:

  • Python 3.4 is no longer supported.

  • aiohttp 3.0 or later is now required for aio metrics exposure.

Deprecations:

none

Changes:

  • python-consul is no longer required for asyncio Consul service discovery. A plain aiohttp is enough now.

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

Uploaded Source

Built Distribution

prometheus_async-18.1.0-py2.py3-none-any.whl (18.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for prometheus_async-18.1.0.tar.gz
Algorithm Hash digest
SHA256 ae85b10fb2bdb52aa20d2960556695fef0a2901542c43398ea00bceda8666627
MD5 b699d727c94e6d8d4a1c52c09f928d4c
BLAKE2b-256 99786ccba331845425210f253a0d2883e4fa8f402b456bb35f66d879f247e3d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prometheus_async-18.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4dc589ed824210cfcab25c13e54aeee31bde57f987530e9b9c2f1cc03ed8a24a
MD5 3d9ecf8f5aa87f5254e5f17b3f05849c
BLAKE2b-256 8355f9708b828a73723be5734c7da5ece960855213fd9828401ac0acbdd35e64

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