fix silence update

This commit is contained in:
HgO 2022-08-08 02:03:25 +02:00
parent 1555359e03
commit f284486570

View file

@ -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(