Skip to main content

HTTP metrics for a aiohttp application

Project description

https://travis-ci.org/globocom/aiohttp-prometheus.svg?branch=master

HTTP metrics for a AIOHTTP application

Installing

pip install aiohttp-prometheus-client

Usage

from aiohttp import web
from aiohttp_prometheus import metrics_middleware, MetricsView

app = web.Application()
app.middlewares.append(metrics_middleware)

app.router.add_route('GET', '/metrics', MetricsView),

web.run_app(app)

Example output for metric route

# HELP aiohttp_http_requests_total Asyncio total Request Count
# TYPE aiohttp_http_requests_total counter
aiohttp_http_requests_total{handler="MetricsView",method="GET",status="2xx"} 7.0

# HELP aiohttp_http_request_duration_seconds Request latency
# TYPE aiohttp_http_request_duration_seconds histogram
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="0.01",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="0.05",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="0.1",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="0.5",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="0.75",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="1.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="2.5",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="5.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="7.5",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="10.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="15.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="20.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="30.0",method="GET"} 7.0
aiohttp_http_request_duration_seconds_bucket{handler="MetricsView",le="+Inf",method="GET"} 7.0

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

aiohttp-prometheus-client-0.1.2.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file aiohttp-prometheus-client-0.1.2.tar.gz.

File metadata

File hashes

Hashes for aiohttp-prometheus-client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5a032102afcae406877e88bea0d1a717ffea59520be3aa590c88144f2f1c14d0
MD5 a4d0a6e5f7e3dba948c5c840e8b3157b
BLAKE2b-256 722ee5c30410bf71a776c288fcb6f62875f476e41ff4b7922b364cb87bfb16b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page