Skip to content

Commit

Permalink
High priority alerts detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rpdevmp committed Dec 5, 2024
1 parent ef1c094 commit 3395f76
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions tests/rptest/redpanda_cloud_tests/observe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,23 @@ def cluster_alerts(self, rule_groups):

@cluster(num_nodes=0, check_allowed_error_logs=False)
def test_cloud_observe(self):
self.logger.debug("Here we go")
self.logger.debug("Starting cloud observe test")

rule_groups = self.load_grafana_rules()

alerts = self.cluster_alerts(rule_groups.data.groups)
high_priority_alerts = []

for alert in alerts:
self.logger.warn(
f'alert firing for cluster: {alert.labels.grafana_folder} / {alert.labels.alertname}'
)

assert len(alerts) == 0
alert_message = f"alert firing for cluster: {alert.labels.grafana_folder} / {alert.labels.alertname}"
if "high priority" in alert_message.lower():
self.logger.error(f"High priority - {alert_message}")
high_priority_alerts.append(alert_message)
else:
self.logger.warning(f"Low priority - {alert_message}")

# Fail the test if high-priority alerts are present
assert not high_priority_alerts, (
f"Test failed due to high-priority alerts:\n{high_priority_alerts}"
)

self.logger.info("Cloud observe test completed successfully.")

0 comments on commit 3395f76

Please sign in to comment.