fix(core): Deduplicate native HTTP breadcrumbs#6132
Open
antonis wants to merge 4 commits into
Open
Conversation
…fetch breadcrumbs Closes #3045 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d52d0ef. Configure here.
Network errors, aborted requests, and CORS failures produce breadcrumbs without a status_code. Treat both sides being null/undefined as a match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously only string timestamps were parsed; numeric timestamps (seconds since epoch) were silently dropped. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
📢 Type of change
📜 Description
When JS makes an HTTP request in React Native, breadcrumbs are created independently by both the JS SDK (
xhrcategory) and the native SDK (httpcategory), because RN's networking layer (fetch/XHR) is implemented via native APIs (NSURLSessionon iOS,OkHttpon Android). This results in duplicate breadcrumbs for every HTTP request.This PR adds deduplication logic in
deviceContextIntegration.processEventthat filters out nativehttpbreadcrumbs when a matching JSxhr/fetchbreadcrumb exists (same method, URL, status code, and timestamp within 2s tolerance).Key design choices:
beforeBreadcrumb, giving users filtering controlstatus_codemismatch — usesNumber()coercion for comparisonAlso updates the FIXME comment in
breadcrumbs.tsto reflect that deduplication now happens indeviceContextIntegration.💡 Motivation and Context
Closes #3045
Users see duplicate HTTP breadcrumbs (2x per request) which crowd out meaningful breadcrumbs and cannot be filtered via
beforeBreadcrumbsince native breadcrumbs bypass that callback.The sentry-cocoa side of this (cocoa producing its own internal duplicates, #2971) was fixed in sentry-cocoa 8.8.0. The remaining duplication is the JS vs native layer, which this PR addresses.
💚 How did you test it?
yarn build)yarn lint)📝 Checklist
sendDefaultPIIis enabled🔮 Next steps