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

TTID is wrong when viewWillAppear isn't called #4383

Closed
philipphofmann opened this issue Oct 1, 2024 · 0 comments · Fixed by #4417
Closed

TTID is wrong when viewWillAppear isn't called #4383

philipphofmann opened this issue Oct 1, 2024 · 0 comments · Fixed by #4417
Assignees

Comments

@philipphofmann
Copy link
Member

philipphofmann commented Oct 1, 2024

Description

When the OS doesn't call viewWillAppear the TTID span gets finished when it's tracer finishes:

// The tracer finishes when the screen is fully displayed. Therefore, we must also finish
// the TTID span.
if (self.initialDisplaySpan.isFinished == NO) {
[self.initialDisplaySpan finish];
}

This is because the reportInitialDisplay only gets called from the SentryUIViewControllerPerformanceTracker when viewWillAppear gets called:

There are scenarios for which the OS doesn't call viewWillAppear; see Apple docs. We could call reportInitialDisplay also in subsequent UIViewController methods that the OS calls before rendering the first frame of the UIViewController, such as viewIsAppearing or viewWillLayoutSubView, etc.

Especially when having performanceV2 enabled, this leads to confusion because the initial frame render of the app start differs from the TTID. The app start metric subscribes to the very first frame being rendered

if (_enablePerformanceV2) {
self.framesTracker = framesTracker;
[framesTracker addListener:self];
}

Maybe we need to align the initial frame render of the app start time with the TTID when fixing this bug.

@github-project-automation github-project-automation bot moved this to Needs Discussion in Mobile & Cross Platform SDK Oct 1, 2024
@philipphofmann philipphofmann moved this from Needs Discussion to Todo in Mobile & Cross Platform SDK Oct 2, 2024
@philipphofmann philipphofmann self-assigned this Oct 7, 2024
@philipphofmann philipphofmann moved this from Todo to In Progress in Mobile & Cross Platform SDK Oct 7, 2024
philipphofmann added a commit that referenced this issue Oct 9, 2024
According to the Apple docs, viewWillAppear should be called before the
UIViewController is added to the view hierarchy. There are some edge
cases, though, when this doesn't happen, and we saw customers'
transactions also proofing this. Therefore, we must also report the
initial display here, as the customers' transactions had spans for
viewWillLayoutSubViews.

Fixes GH-4383
philipphofmann added a commit that referenced this issue Oct 9, 2024
According to the Apple docs, viewWillAppear should be called before the
UIViewController is added to the view hierarchy. There are some edge
cases, though, when this doesn't happen, and we saw customers'
transactions also proofing this. Therefore, we must also report the
initial display here, as the customers' transactions had spans for
viewWillLayoutSubViews.

Fixes GH-4383
@github-project-automation github-project-automation bot moved this from In Progress to Done in Mobile & Cross Platform SDK Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant