From f284486570a87dec3a613a6b86f7fb50f4c7283c Mon Sep 17 00:00:00 2001 From: HgO Date: Mon, 8 Aug 2022 02:03:25 +0200 Subject: [PATCH] fix silence update --- matrix_alertbot/alertmanager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/matrix_alertbot/alertmanager.py b/matrix_alertbot/alertmanager.py index 2d00366..b8754d0 100644 --- a/matrix_alertbot/alertmanager.py +++ b/matrix_alertbot/alertmanager.py @@ -71,6 +71,8 @@ class AlertmanagerClient: ) -> str: alert = await self.get_alert(fingerprint) + logger.debug(f"Creating silence for alert with fingerprint {fingerprint}") + silence_matchers = [ {"name": label, "value": value, "isRegex": False, "isEqual": True} for label, value in alert["labels"].items() @@ -101,7 +103,9 @@ class AlertmanagerClient: f"Cannot find silence for alert with fingerprint {fingerprint} in cache." ) - logger.debug(f"Updating silence with ID {silence_id}") + logger.debug( + f"Updating silence with ID {silence_id} for alert with fingerprint {fingerprint}" + ) if duration_seconds is None: if expire_time is not None: @@ -115,7 +119,7 @@ class AlertmanagerClient: silence_matchers = silence["matchers"] return await self._create_or_update_silence( - fingerprint, silence_matchers, user, duration_seconds + fingerprint, silence_matchers, user, duration_seconds, silence_id ) async def create_or_update_silence(