Skip to content

Commit

Permalink
fix(replay): network breadcrumbs with tracing disabled were missing s…
Browse files Browse the repository at this point in the history
…tart timestamp (#4091)

Session replay should be independent of the tracing (performance).
  • Loading branch information
krystofwoldrich authored Jun 25, 2024
1 parent 6956d43 commit 2e3ef92
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 167 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- `storeEnvelope` ends session for unhandled errors (#4073)
- Deprecate `SentryUser.segment`(#4092). Please remove usages of this property. We will remove it in the next major.
- Sentry Replay Network details should be available without Tracing (#4091)

## 8.29.1

Expand Down
10 changes: 6 additions & 4 deletions Sources/Sentry/SentryNetworkTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ - (void)urlSessionTaskResume:(NSURLSessionTask *)sessionTask
return;
}

// Register request start date in the sessionTask to use for breadcrumb
if (self.isNetworkBreadcrumbEnabled) {
objc_setAssociatedObject(sessionTask, &SENTRY_NETWORK_REQUEST_START_DATE, [NSDate date],
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@synchronized(self) {
if (!self.isNetworkTrackingEnabled) {
[self addTraceWithoutTransactionToTask:sessionTask];
Expand Down Expand Up @@ -220,10 +226,6 @@ - (void)urlSessionTaskResume:(NSURLSessionTask *)sessionTask
@"SentryNetworkTracker automatically started HTTP span for sessionTask: %@",
netSpan.description);

// Register request start date in the sessionTask to use for breadcrumb
objc_setAssociatedObject(sessionTask, &SENTRY_NETWORK_REQUEST_START_DATE, [NSDate date],
OBJC_ASSOCIATION_RETAIN_NONATOMIC);

objc_setAssociatedObject(sessionTask, &SENTRY_NETWORK_REQUEST_TRACKER_SPAN, netSpan,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
Expand Down
Loading

0 comments on commit 2e3ef92

Please sign in to comment.