Skip to content

slack: retry on 429 and honor Retry-After header#5048

Open
biwwy0 wants to merge 1 commit intoprometheus:mainfrom
biwwy0:slack-retry-after-429
Open

slack: retry on 429 and honor Retry-After header#5048
biwwy0 wants to merge 1 commit intoprometheus:mainfrom
biwwy0:slack-retry-after-429

Conversation

@biwwy0
Copy link

@biwwy0 biwwy0 commented Feb 26, 2026

Make HTTP 429 (Too Many Requests) retryable for the Slack notifier by adding http.StatusTooManyRequests to the retrier's RetryCodes, matching the pattern already used by PagerDuty, OpsGenie, Jira, and incident.io.

Additionally, parse the Retry-After response header on 429 responses and sleep for the indicated duration before returning. This addresses the concern raised when a similar change was reverted in #2128: simply retrying 429 without honoring Retry-After causes rapid-fire retries that risk getting apps permanently disabled by Slack. The sleep respects context cancellation.

Fixes #2111
Ref #2205

Pull Request Checklist

Please check all the applicable boxes.

  • Please list all open issue(s) discussed with maintainers related to this change
    • Fixes #
  • Is this a new Receiver integration?
  • Is this a bugfix?
    • I have added tests that can reproduce the bug which pass with this bugfix applied
  • Is this a new feature?
    • I have added tests that test the new feature's functionality
  • Does this change affect performance?
    • I have provided benchmarks comparison that shows performance is improved or is not degraded
      • You can use benchstat to compare benchmarks
    • I have added new benchmarks if required or requested by maintainers
  • Is this a breaking change?
    • My changes do not break the existing cluster messages
    • My changes do not break the existing api
  • I have added/updated the required documentation
  • I have signed-off my commits
  • I will follow best practices for contributing to this project

Which user-facing changes does this PR introduce?

[ENHANCEMENT] slack: retry on 429 honoring Retry-After header

Make HTTP 429 (Too Many Requests) retryable for the Slack notifier by
adding http.StatusTooManyRequests to the retrier's RetryCodes, matching
the pattern already used by PagerDuty, OpsGenie, Jira, and incident.io.

Additionally, parse the Retry-After response header on 429 responses and
sleep for the indicated duration before returning. This addresses the
concern raised when a similar change was reverted in prometheus#2128: simply
retrying 429 without honoring Retry-After causes rapid-fire retries that
risk getting apps permanently disabled by Slack. The sleep respects
context cancellation.

Fixes prometheus#2111
Ref prometheus#2205

Signed-off-by: Anton Ivanov <antonivanov@bitgo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack Integration does not respect rate limiting

1 participant