Skip to content

Commit

Permalink
Fixes the critical alerts exception with the start_time > end_time
Browse files Browse the repository at this point in the history
Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani authored and chaitanyaenr committed Jan 15, 2024
1 parent 631f12b commit aa030a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion run_kraken.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def main(cfg):

# Capture the start time
start_time = int(time.time())

chaos_telemetry = ChaosRunTelemetry()
chaos_telemetry.run_uuid = run_uuid
# Loop to run the chaos starts here
Expand Down Expand Up @@ -345,7 +346,13 @@ def main(cfg):

##PROM
query = r"""ALERTS{severity="critical"}"""
critical_alerts = prometheus.process_prom_query_in_range(query, datetime.datetime.fromtimestamp(start_time))
end_time = datetime.datetime.now()
critical_alerts = prometheus.process_prom_query_in_range(
query,
start_time = datetime.datetime.fromtimestamp(start_time),
end_time = end_time

)
critical_alerts_count = len(critical_alerts)
if critical_alerts_count > 0:
logging.error("Critical alerts are firing: %s", critical_alerts)
Expand Down

0 comments on commit aa030a2

Please sign in to comment.