Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ttd): Add span ids to time to display debug logs #3868

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fix

- Add missing logs to dropped App Start spans ([#3861](https://github.com/getsentry/sentry-react-native/pull/3861))
- Add Span IDs to Time to Display debug logs ([#3868](https://github.com/getsentry/sentry-react-native/pull/3868))

## 5.23.0

Expand Down
11 changes: 6 additions & 5 deletions src/js/tracing/timetodisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds: number): void {

if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {
fullDisplayBeforeInitialDisplay.delete(activeSpan);
logger.debug(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);
updateFullDisplaySpan(frameTimestampSeconds, span);
}

Expand All @@ -233,7 +234,7 @@ function updateInitialDisplaySpan(frameTimestampSeconds: number): void {
function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {
const activeSpan = getActiveSpan();
if (!activeSpan) {
logger.warn(`[TimeToDisplay] No active span found to attach ui.load.full_display to.`);
logger.warn(`[TimeToDisplay] No active span found to update ui.load.full_display in.`);
return;
}

Expand All @@ -247,25 +248,25 @@ function updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDispl
const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;
if (!initialDisplayEndTimestamp) {
fullDisplayBeforeInitialDisplay.set(activeSpan, true);
logger.warn(`[TimeToDisplay] Full display called before initial display for active span.`);
logger.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);
return;
}

const span = startTimeToFullDisplaySpan();
if (!span) {
logger.warn(`[TimeToDisplay] No span found or created, possibly performance is disabled.`);
logger.warn(`[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.`);
return;
}

if (spanToJSON(span).timestamp) {
logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);
logger.warn(`[TimeToDisplay] ${spanToJSON(span).description} (${span.spanContext().spanId}) span already ended.`);
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
return;
}

span.end(frameTimestampSeconds);

span.setStatus('ok');
logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp.`);
logger.debug(`[TimeToDisplay] ${spanToJSON(span).description} (${span.spanContext().spanId}) span updated with end timestamp.`);

setSpanDurationAsMeasurement('time_to_full_display', span);
}
Loading