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

19.2.0 (2019-01-17)

Backward-incompatible changes:

none

Deprecations:

none

Changes:

  • Revert the switch to decorator.py since it turned out to be a very breaking change. Please note that the now current release of wrapt 1.11.0 has a memory leak so you should blacklist it in your lockfile.

    Sorry for the inconvenience that has been caused!

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

Uploaded Source

Built Distribution

prometheus_async-19.2.0-py2.py3-none-any.whl (16.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: prometheus_async-19.2.0.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for prometheus_async-19.2.0.tar.gz
Algorithm Hash digest
SHA256 3cc68d1f39e9bbf16dbd0b51103d87671b3cbd1d75a72cda472cd9a35cc9d0d2
MD5 910c0d630b6f20296b6739c7c28699a7
BLAKE2b-256 2a6449b877e874326f9f25ee534b0070cfc817caf0ab0c78cdea45495f6047a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prometheus_async-19.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for prometheus_async-19.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 227f516e5bf98a0dc602348381e182358f8b2ed24a8db05e8e34d9cf027bab83
MD5 f4146805173d971826fca7734edcc9c0
BLAKE2b-256 85193b0d557329b72bb4cb5af04bb5c5204bee6e8886b6520595320fb5c939d6

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