Skip to content

Commit

Permalink
checking post run alerts properties presence (krkn-chaos#584)
Browse files Browse the repository at this point in the history
added metric check

Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani authored Mar 1, 2024
1 parent 706a886 commit b9c0bb3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kraken/prometheus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ def critical_alerts(prom_cli: KrknPrometheus,
)

for alert in post_critical_alerts:
alert = ChaosRunAlert(alert["metric"]["alertname"], alert["metric"]["alertstate"], alert["metric"]["namespace"], alert["metric"]["severity"])
summary.post_chaos_alerts.append(alert)
if "metric" in alert:
alertname = alert["metric"]["alertname"] if "alertname" in alert["metric"] else "none"
alertstate = alert["metric"]["alertstate"] if "alertstate" in alert["metric"] else "none"
namespace = alert["metric"]["namespace"] if "namespace" in alert["metric"] else "none"
severity = alert["metric"]["severity"] if "severity" in alert["metric"] else "none"
alert = ChaosRunAlert(alertname, alertstate, namespace, severity)
summary.post_chaos_alerts.append(alert)

during_critical_alerts_count = len(during_critical_alerts)
post_critical_alerts_count = len(post_critical_alerts)
Expand Down

0 comments on commit b9c0bb3

Please sign in to comment.