feat(http): add RetryStrategy and context-driven configuration#317
Conversation
Introduce RetryStrategy, a callback-based retry mechanism that supersedes the legacy exponential-backoff RetryConfig loop. The strategy owns the attempt cap and retry decision for each HTTP attempt, supporting custom logic like Retry-After header parsing via the new RetryOnStatus helper. Add WithContext and WithLogger methods to configure clients from context objects, enabling per-feature HTTP tracing and HAR collection. TraceToStdout now deduplicates multiple calls by merging configs into a single installed middleware instead of stacking. Add CommonsHTTPContext interface for context objects to provide logger, trace config, and HAR collector. Implement metadataHARMiddleware for low-cost HAR capture (headers/timing only, no bodies). Add WriteHARFile to serialize HAR entries to disk. Add traceConfigForLevel to derive trace config from logger verbosity levels (Trace1 for headers, Trace2 for bodies), making -vvv/-vvvv flags automatically enable tracing. Breaking change: Client.traceMW and related internals are now exposed for deduplication logic; existing code using Trace() or TraceToStdout() continues to work but may see different middleware stacking behavior. Refs: HAR collection, context-driven configuration, improved retry control
|
Warning Review limit reached
More reviews will be available in 39 minutes and 43 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Gavel summary
Totals: 380 passed · 0 failed · 11 skipped · 57.5s |
|
🎉 This PR is included in version 1.52.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What
RetryStrategycallback-based retry mechanism withRetryOnStatushelperWithContextandWithLoggermethods for context-driven client configurationmetadataHARMiddlewarefor low-cost HAR capture (headers/timing only)WriteHARFileto serialize HAR entries to disktraceConfigForLevelto derive trace config from logger verbosity levelsWhy
RetryConfigloop with more flexible strategy patternTraceToStdoutcalls by merging configs into single middleware-vvv/-vvvvflagsNotes
Client.traceMWand related internals now exposed; existingTrace()andTraceToStdout()calls continue to work but may see different middleware stacking behaviorCommonsHTTPContextinterface implementation for context objects