Conversation
b133fd6 to
93db900
Compare
03b4c49 to
08697e5
Compare
|
d20984f to
dd39920
Compare
3a646a5 to
47ca4e4
Compare
mujacica
approved these changes
Apr 7, 2026
supervacuus
reviewed
Apr 7, 2026
Subtract reported values instead of zeroing to preserve concurrent increments that happen between read and reset.
Use the item type string directly to determine the data category instead of going through the lossy RL category mapping.
The rate limiter is updated from the response headers before the status code is returned. Pass NULL to skip the stale rate limiter check since all items were already serialized and sent.
Split http_send_request so the rate limiter is updated after recording discards, not before. This ensures items that were rate-limited during serialization are not also counted as send_error.
Replaces the read-then-subtract approach with atomic exchange (store 0). Each counter value is now consumed exactly once, so no discard counts are lost under concurrent access. The tradeoff is that counts are drained at read time, so they are lost if the envelope item allocation fails afterwards. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Counters from a previous session carry over and get piggybacked onto the next outgoing envelope, which is acceptable for best-effort telemetry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Retried envelopes are raw (opaque bytes from disk), so their items cannot be inspected directly. Serialize and deserialize the raw envelope to get structured items for discard recording. Also skip into_envelope for raw envelopes to prevent draining counters into an envelope that cannot accept new items. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Per the developer docs: "For an HTTP 429 Too Many Requests response, SDKs MUST discard the envelope, but MUST NOT record a client report, because the upstream already does this." https://develop.sentry.dev/sdk/telemetry/client-reports/#rate-limited-http-429 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split sentry__client_report_into_envelope into sentry__client_report_save + sentry__envelope_add_client_report so that on send failure, the consumed counts can be restored via sentry__client_report_restore instead of being silently lost with the discarded envelope. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace sentry__envelope_is_rate_limited() with sentry__envelope_can_add_client_report() which also rejects raw (file-backed) envelopes. This prevents the transport from draining global discard counters into a report that cannot be attached to a raw envelope, which would silently lose the counts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a674385 to
2586cdb
Compare
supervacuus
approved these changes
Apr 8, 2026
Collaborator
supervacuus
left a comment
There was a problem hiding this comment.
I like the changes applied to the counts 👍
Also, client reports beautifully highlight the value of your transport refactorings. Thanks again for that.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Zero the report struct after restoring so that a double restore does not double the counts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7c5044d. Configure here.
1 task
jpnurmi
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Apr 10, 2026
Document the new send_client_reports option added in sentry-native 0.13.6 (getsentry/sentry-native#1549), which lets users opt out of client reports tracking for discarded events.
6 tasks
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.

Track and report discarded events per the client reports spec:
sample_rate: events dropped by the sample ratebefore_send: events, transactions, logs, and metrics dropped by before-send hooksratelimit_backoff: envelope items dropped by rate limiternetwork_error: envelope items lost on send failuresend_error: envelope items rejected by the server (4xx/5xx)queue_overflow: logs and metrics dropped when the batcher is fullReports are opportunistically attached to outgoing envelopes. Opt-out via
sentry_options_set_send_client_reports().Close: #1216