fix silence update
This commit is contained in:
parent
1555359e03
commit
f284486570
1 changed files with 6 additions and 2 deletions
|
@ -71,6 +71,8 @@ class AlertmanagerClient:
|
||||||
) -> str:
|
) -> str:
|
||||||
alert = await self.get_alert(fingerprint)
|
alert = await self.get_alert(fingerprint)
|
||||||
|
|
||||||
|
logger.debug(f"Creating silence for alert with fingerprint {fingerprint}")
|
||||||
|
|
||||||
silence_matchers = [
|
silence_matchers = [
|
||||||
{"name": label, "value": value, "isRegex": False, "isEqual": True}
|
{"name": label, "value": value, "isRegex": False, "isEqual": True}
|
||||||
for label, value in alert["labels"].items()
|
for label, value in alert["labels"].items()
|
||||||
|
@ -101,7 +103,9 @@ class AlertmanagerClient:
|
||||||
f"Cannot find silence for alert with fingerprint {fingerprint} in cache."
|
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 duration_seconds is None:
|
||||||
if expire_time is not None:
|
if expire_time is not None:
|
||||||
|
@ -115,7 +119,7 @@ class AlertmanagerClient:
|
||||||
silence_matchers = silence["matchers"]
|
silence_matchers = silence["matchers"]
|
||||||
|
|
||||||
return await self._create_or_update_silence(
|
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(
|
async def create_or_update_silence(
|
||||||
|
|
Loading…
Reference in a new issue