From f64a66dec7a10dd10032e873ef103fa89fb45570 Mon Sep 17 00:00:00 2001 From: Aleksandr Kurlov Date: Fri, 19 Jul 2024 11:45:21 +0200 Subject: [PATCH] Add rate to throttled metric --- resources/prometheus/prometheus-rules.yaml | 6 +++--- .../unit_tests/RHACSEmailsenderThrottledSend.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/prometheus/prometheus-rules.yaml b/resources/prometheus/prometheus-rules.yaml index 9067d39..37e647d 100644 --- a/resources/prometheus/prometheus-rules.yaml +++ b/resources/prometheus/prometheus-rules.yaml @@ -203,13 +203,13 @@ spec: sop_url: "https://gitlab.cee.redhat.com/stackrox/acs-managed-service-runbooks/blob/master/sops/dp-047-emailsender-ses-send-error.md" - alert: RHACSEmailsenderThrottledSend expr: | - acs_emailsender_throttled_send_email_total > 0 - for: 5m + rate(acs_emailsender_throttled_send_email_total[10m]) * 60 > 0 + for: 10m labels: severity: warning annotations: summary: "Email Sender throttled sending for `{{ $labels.tenant_id }}` Central instance" - description: "Email Sender is throttled {{ $value }} times for `{{ $labels.tenant_id }}` Central" + description: "Email Sender throttled `{{ $labels.tenant_id }}` Central {{ $value | humanize }} time(s) per minute over the last 10 minutes." sop_url: "https://gitlab.cee.redhat.com/stackrox/acs-managed-service-runbooks/blob/master/sops/dp-048-emailsender-ses-send-throttled.md" - name: tenant-resources diff --git a/resources/prometheus/unit_tests/RHACSEmailsenderThrottledSend.yaml b/resources/prometheus/unit_tests/RHACSEmailsenderThrottledSend.yaml index 00ced4e..a270dc6 100644 --- a/resources/prometheus/unit_tests/RHACSEmailsenderThrottledSend.yaml +++ b/resources/prometheus/unit_tests/RHACSEmailsenderThrottledSend.yaml @@ -7,7 +7,7 @@ tests: - interval: 1m input_series: - series: acs_emailsender_throttled_send_email_total{namespace="rhacs", pod="emailsender-123", container="emailsender", tenant_id="centralid"} - values: "0+0x10 2+0x50" + values: "0+0x10 2+1x60" alert_rule_test: - eval_time: 15m alertname: RHACSEmailsenderThrottledSend @@ -24,5 +24,5 @@ tests: severity: warning exp_annotations: summary: "Email Sender throttled sending for `centralid` Central instance" - description: "Email Sender is throttled 2 times for `centralid` Central" + description: "Email Sender throttled `centralid` Central 1 time(s) per minute over the last 10 minutes." sop_url: "https://gitlab.cee.redhat.com/stackrox/acs-managed-service-runbooks/blob/master/sops/dp-048-emailsender-ses-send-throttled.md"