link alertmanager client to prometheus metrics

This commit is contained in:
HgO 2022-07-09 12:47:19 +02:00
parent 38d12512ef
commit f3151cee4c

View file

@ -6,6 +6,7 @@ from typing import Any, Dict, List
import aiohttp
import pytimeparse
from aiohttp import ClientError
from aiohttp_prometheus_exporter.trace import PrometheusTraceConfig
from diskcache import Cache
from matrix_alertbot.errors import (
@ -19,7 +20,7 @@ class AlertmanagerClient:
def __init__(self, url: str, cache: Cache) -> None:
self.api_url = f"{url}/api/v2"
self.cache = cache
self.session = aiohttp.ClientSession()
self.session = aiohttp.ClientSession(trace_configs=[PrometheusTraceConfig()])
async def close(self) -> None:
await self.session.close()