feat(network-details): Extract network details data to Session Replay#7590
feat(network-details): Extract network details data to Session Replay#759043jay wants to merge 8 commits intomobile-935/hook-up-sentry-network-trackerfrom
Conversation
|
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## mobile-935/hook-up-sentry-network-tracker #7590 +/- ##
=============================================================================
Coverage ? 85.149%
=============================================================================
Files ? 490
Lines ? 29696
Branches ? 12828
=============================================================================
Hits ? 25286
Misses ? 4359
Partials ? 51
Continue to review full report in Codecov by Sentry.
|
5f57b05 to
a4f221a
Compare
7cda42c to
c8da718
Compare
a4f221a to
fde4a5e
Compare
c8da718 to
e9fcc6c
Compare
fde4a5e to
8b6853c
Compare
e9fcc6c to
46f7481
Compare
46f7481 to
f35da26
Compare
8b6853c to
624e1f5
Compare
f35da26 to
f4312a8
Compare
d80d538 to
d08a33e
Compare
f4312a8 to
af0159e
Compare
d08a33e to
d5a8320
Compare
af0159e to
3852520
Compare
d5a8320 to
80df62b
Compare
3852520 to
58aafe3
Compare
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.
d43fd3c to
efa243d
Compare
c84ff73 to
5ea8b46
Compare
efa243d to
8079837
Compare
a741581 to
a925d4a
Compare
22fcb76 to
bb3966d
Compare
a925d4a to
44d3c4a
Compare
bb3966d to
dd6c72f
Compare
44d3c4a to
ce99b96
Compare
dd6c72f to
54aca68
Compare
philprime
left a comment
There was a problem hiding this comment.
LGTM, thanks for incorporating all the changes. Left some comments to consider.
8ed9f7e to
fd27574
Compare
ce99b96 to
ac079a2
Compare
…Event Add populated NetworkRequestData to breadcrumb data SentryNetworkTracker#addBreadcrumbForSessionTask Read NetworkRequestData from breadcrumb when converting for session replay SentrySRDefaultBreadcrumbConverter
… breadcrumb #7588 (comment) in testing, the completionHandler is invoked after setState(.completed) returns. However based on research this is not guaranteed so lock so ensure no concurrent access to obj_get|setAssociatedState
RRWebOptionsEvent payload shows up in the `tags` panel on a session replay. networkDetailHasUrls is required to light-up the UI.
…b converter Document that all network detail fields are optional in the RRWebEvent produced by addNetworkDetails. The backend accepts partial data and the replay UI omits missing fields. Tests added: - onlyStatusCode: response status code set, no method/sizes - onlyMethod: method set via init, no response at all - onlyResponseBodySize: only response body size set - onlyRequestBodySize: only request body size set - emptyDetails: nil method + no request/response = no extra keys Run: make test-ios ONLY_TESTING=SentrySRDefaultBreadcrumbConverterTests
Assert header/key counts to catch unexpected additions to the emitted payload: - SentryNetworkTrackerTests: assert request/response header counts - SentrySRDefaultBreadcrumbConverterTests: assert payloadData.count for each partial-data case
ac079a2 to
88ba36b
Compare
fd27574 to
1310652
Compare
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|

📜 Description
Upload network details data (
SentryNetworkRequestData) extracted by SentryNetworkTracker to the session replay backend.SentryNetworkRequestDataStored on the NSURLSessionTask while waiting for data (see previous prs)
SentryNetworkRequestData *networkRequestData = objc_setAssociatedObject(sessionTask, &SentryNetworkRequestDataKey);Stored in the Breadcrumb data after task has completed (
addBreadcrumbForSessionTask) (THIS PR)Extracted from Breadcrumb into RRWebEvent (
SentrySRDefaultBreadcrumbConverter) (THIS PR)💡 Motivation and Context
Last leg of data upload; now data is visible in replay dash.
💚 How did you test it?
Manual Testing with iOS-Swift test app
Navigate to Extras > Network Details
Initiate different types of request
Navigate to sentry.io test project and confirm session replay 'Network' tab shows requests with correct body and headers.
https://sentry-sdks.sentry.io/explore/replays/f5cff413ffd94561819...
Unit tests
Summary:
📝 Checklist
You have to check all boxes before merging:
sendDefaultPIIis enabled. gated by SentryReplayOptions#networkDetailAllowUrlsCloses #7591