Skip to main content

Async helpers for prometheus_client.

Project description

https://travis-ci.org/hynek/prometheus_async.svg?branch=master https://codecov.io/github/hynek/prometheus_async/coverage.svg?branch=master

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

Currently asyncio (Python 3.4, 3.5) and Twisted (Python 2.7, 3.4, 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

16.2.0 (2016-10-28)

Changes:

  • When using the aiohttp metrics exporter, create the web application using an explicit loop argument. #6

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

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for prometheus_async-16.2.0.tar.gz
Algorithm Hash digest
SHA256 a24c6985ed02342647872dec856d64eeeb32433380dcdcdd4eff0228356879a6
MD5 466080ec743ec6af60ea86e9b95260e0
BLAKE2b-256 9223c211a19d5e1a80be1a4c8694a6528bec402d8111faff383d658d0811ce4e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prometheus_async-16.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 230c4264908cfb4a0b21dfab2bdd6233bb5050e4e59e4b8aec4a86ea2adcd0e4
MD5 2fc7f9342641de482a28f79026196f3d
BLAKE2b-256 88a63776401101e89c1a2d2531673c73b8c937e9e215ee45e3436d10e1470195

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