Skip to content

Conversation

@jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Aug 19, 2025

Resolves #2410


Note

Introduces optional automatic backpressure handling that dynamically downsamples events/traces based on queue overflows and server rate limits, wired through worker, transport, hub, and client with full test coverage.

  • Feature: Backpressure handling
    • Add BackpressureMonitor and new option SentryOptions.EnableBackpressureHandling (incl. config binding) to automatically reduce SampleRate/TracesSampleRate when under pressure.
    • Record signals from BackgroundWorker (queue overflows) and HttpTransportBase (rate-limit headers) to drive downsampling; mark discards with DiscardReason.Backpressure.
    • Apply downsample factor in Hub.StartTransaction and SentryClient.DoSendEvent; dispose monitor on hub shutdown.
  • Plumbing
    • Thread monitor through SdkComposer, BackgroundWorker, LazyHttpTransport/HttpTransport, and HttpTransportBase (constructor changes).
    • Minor benchmark/test adjustments for updated signatures.
  • Tests & API
    • Add comprehensive unit tests for backpressure behavior; update public API approvals to include EnableBackpressureHandling.
  • Docs
    • Update CHANGELOG.md with the new feature.

Written by Cursor Bugbot for commit 415308d. This will update automatically on new commits. Configure here.

@jamescrosswell jamescrosswell marked this pull request as ready for review August 19, 2025 22:33
@jamescrosswell jamescrosswell self-assigned this Aug 19, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

alexsohn1126 pushed a commit that referenced this pull request Oct 11, 2025
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.

Backpressure Management

5 participants