link alertmanager client to prometheus metrics
This commit is contained in:
parent
38d12512ef
commit
f3151cee4c
1 changed files with 2 additions and 1 deletions
|
@ -6,6 +6,7 @@ from typing import Any, Dict, List
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import pytimeparse
|
import pytimeparse
|
||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
|
from aiohttp_prometheus_exporter.trace import PrometheusTraceConfig
|
||||||
from diskcache import Cache
|
from diskcache import Cache
|
||||||
|
|
||||||
from matrix_alertbot.errors import (
|
from matrix_alertbot.errors import (
|
||||||
|
@ -19,7 +20,7 @@ class AlertmanagerClient:
|
||||||
def __init__(self, url: str, cache: Cache) -> None:
|
def __init__(self, url: str, cache: Cache) -> None:
|
||||||
self.api_url = f"{url}/api/v2"
|
self.api_url = f"{url}/api/v2"
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
self.session = aiohttp.ClientSession()
|
self.session = aiohttp.ClientSession(trace_configs=[PrometheusTraceConfig()])
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
await self.session.close()
|
await self.session.close()
|
||||||
|
|
Loading…
Reference in a new issue