add prometheus exporter

This commit is contained in:
HgO 2022-07-09 12:43:18 +02:00
parent 25796595f3
commit 38d12512ef

View file

@ -4,6 +4,8 @@ import logging
from typing import Any
from aiohttp import web, web_request
from aiohttp_prometheus_exporter.handler import metrics
from aiohttp_prometheus_exporter.middleware import prometheus_middleware_factory
from diskcache import Cache
from nio import AsyncClient, SendRetryError
@ -57,6 +59,10 @@ class Webhook:
self.app["config"] = config
self.app["cache"] = cache
self.app.add_routes(routes)
self.app.middlewares.append(prometheus_middleware_factory())
self.app.router.add_get("/metrics", metrics())
self.runner = web.AppRunner(self.app)
self.config = config