Prometheus exporter for aiohttp server and client.
Project description
Export aiohttp metrics for Prometheus.io
Usage
Requirements
aiohttp >= 3
Installation
Install with:
pip install aiohttp-prometheus-exporter
Server quickstart
from aiohttp import web
from aiohttp_prometheus_exporter.handler import metrics
from aiohttp_prometheus_exporter.middleware import prometheus_middleware_factory
async def hello(request):
return web.Response(text="Hello, world")
app = web.Application()
app.add_routes([web.get('/', hello)])
app.middlewares.append(prometheus_middleware_factory())
app.router.add_get("/metrics", metrics())
web.run_app(app)
Client quickstart
import aiohttp
from aiohttp_prometheus_exporter.trace import PrometheusTraceConfig
async with aiohttp.ClientSession(trace_configs=[PrometheusTraceConfig()) as session:
async with session.get('http://httpbin.org/get') as resp:
print(resp.status)
print(await resp.text())
Now, client metrics are attached to metrics exposed by your web server.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.2.4 (2020-04-07)
Fixed building problems
Configured black linter
0.1.0 (2020-04-07)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aiohttp_prometheus_exporter-0.2.4.tar.gz.
File metadata
- Download URL: aiohttp_prometheus_exporter-0.2.4.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caec41f7fee35b4779994c157f9118f69bde0886460566affc0aaf31c8a34a1b
|
|
| MD5 |
7a2bb1db23a009918f68ebe1340f3ec8
|
|
| BLAKE2b-256 |
025d9591729be12bf51d2117eaceab0c63a5bb7953fc8e34c043d20f55c487e2
|
File details
Details for the file aiohttp_prometheus_exporter-0.2.4-py2.py3-none-any.whl.
File metadata
- Download URL: aiohttp_prometheus_exporter-0.2.4-py2.py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e32d12182d0c7728a7a68e7eefd1b35aa10150576c968dfd28cc63cb152e36b
|
|
| MD5 |
22732acf0f604f3e7e2324df88077fc0
|
|
| BLAKE2b-256 |
3da7a8ec1b5f77ffc68c3b76612bcc9966e989cd2ef3ccf15ed7d18e1a0e2f44
|