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

Usage

from aiohttp import web
from aiohttp_prometheus import MetricsMiddleware, MetricsView

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

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-0.1.0.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

aiohttp_prometheus-0.1.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

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