feat: enforce retry budget across outbound calls - #726
Open
Obaara293 wants to merge 2 commits into
Open
Conversation
Introduce a sliding-window retry budget that limits retries to 10% of successful requests (default). Once the budget is exhausted, further retries fail fast to prevent thundering-herd storms against downstreams. - New package internal/resilience with RetryBudget implementation using a ring of time buckets for efficient sliding windows - Wire budget into outbox dispatcher per-publisher and per-event retry loops - Emit retry_budget_available (gauge) and retry_denied_total (counter) metrics - Document tuning defaults in docs/ops/retry-budget.md
3 tasks
Keep retry budget initialization and backlog metrics loop from main.
Contributor
Author
|
@thlpkee20-wq — requesting review of this work. This is a re-raise of #561, which was closed as “not assigned.” That reason was incorrect:
GitHub blocked reopening #561 after the maintainer close, so this PR (#726) was opened from the same branch and links Please review when you can. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a sliding-window Retry Budget that limits retries to 10% of successful requests (configurable). Once the budget is exhausted, further retries fail fast to prevent thundering-herd storms against downstream services.
Related Issue
Closes #424
Note
Re-raise of #561, which was closed with an incorrect “not assigned” reason. @Obaara293 was assigned to #424 on Jul 27, 19:57 UTC (~23h before the original PR).
Changes
Retry Budget Engine
[ADD]
internal/resilience/retry_budget.goRecordSuccess()/AllowRetry()/RecordRetry()/Available()/Snapshot()APIRetryBudgetgets sensible defaults[MODIFY]
internal/outbox/dispatcher.goRetryBudgetfield toDispatcherConfigdrainOnceForPublisher(per-publisher retry loop) andhandlePublishError(per-event retry path)"retry budget exhausted"error message[MODIFY]
internal/outbox/metrics.goretry_budget_availablegauge (0.0–1.0)retry_denied_totalcounter[ADD]
docs/ops/retry-budget.mdVerification Results
retry_budget_availableandretry_denied_totalmetrics emitteddocs/ops/docs/ops/retry-budget.md