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.
Release files for aiohttp-prometheus-exporter 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiohttp_prometheus_exporter-0.2.4.tar.gz | 15.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiohttp_prometheus_exporter-0.2.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 23.4 kB
Release files / aiohttp_prometheus_exporter-0.2.4.tar.gz
| Download URL | aiohttp_prometheus_exporter-0.2.4.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caec41f7fee35b4779994c157f9118f69bde0886460566affc0aaf31c8a34a1b
|
|
BLAKE2b-256 checksum How to use checksums |
025d9591729be12bf51d2117eaceab0c63a5bb7953fc8e34c043d20f55c487e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / aiohttp_prometheus_exporter-0.2.4-py2.py3-none-any.whl
| Download URL | aiohttp_prometheus_exporter-0.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8e32d12182d0c7728a7a68e7eefd1b35aa10150576c968dfd28cc63cb152e36b
|
|
BLAKE2b-256 checksum How to use checksums |
3da7a8ec1b5f77ffc68c3b76612bcc9966e989cd2ef3ccf15ed7d18e1a0e2f44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|