You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with the reportFullDisplay API:
ViewControllerA opens, starts a HTTP request, user clicks a button and opens ViewControllerB.
ViewControllerB starts an HTTP request.
ViewControllerA’s HTTP request ends and SentrySDK.reportFullyDisplayed is called.
This will finish TTFD for ViewControllerB, but it is still waiting for its request to respond.
Test inside SentryUIViewControllerPerformanceTrackerTests.swift from #4531 to reproduce the problem:
func test_waitForFullDisplay_NewViewControllerLoaded_BeforeReportTTFD_withBackgroundWork()throws{classCustomVC:UIViewController{varworkSpan:Span?overridefunc viewDidAppear(_ animated:Bool){
super.viewDidAppear(animated)
//Start some work, it could be a http request
workSpan =SentrySDK.span?.startChild(operation:"Work")}
// We will use a function to finish the work
// but it could be the request response
func finishWork(){
workSpan?.finish()SentrySDK.reportFullyDisplayed()}}letdateProvider= fixture.dateProvider
letsut= fixture.getSut()lettracker= fixture.tracker
letfirstController=CustomVC()letsecondController=CustomVC()varfirstTracer:SentryTracer?varsecondTracer:SentryTracer?
sut.enableWaitForFullDisplay = true
dateProvider.advance(by:1)
sut.viewControllerLoadView(firstController){
firstController.loadView()
firstTracer =self.getStack(tracker).first as?SentryTracer}
sut.viewControllerViewDidLoad(firstController){
firstController.viewDidLoad()}
dateProvider.advance(by:1)
sut.viewControllerViewWillAppear(firstController){
firstController.viewWillAppear(false)}
sut.viewControllerViewDidAppear(firstController){
firstController.viewDidAppear(false)}
fixture.displayLinkWrapper.normalFrame()letfirstFullDisplaySpan=tryXCTUnwrap(firstTracer?.children.first{ $0.operation =="ui.load.full_display"})XCTAssertFalse(firstFullDisplaySpan.isFinished)XCTAssertEqual(firstTracer?.traceId,SentrySDK.span?.traceId)
dateProvider.advance(by:1)
sut.viewControllerLoadView(secondController){
secondController.loadView()
secondTracer =self.getStack(tracker).first as?SentryTracer}
// The work of the first controller asynchronously ended here, and a new frame was rendered
// while the second controller hasn’t appeared yet.
dateProvider.advance(by:1)
firstController.finishWork()
fixture.displayLinkWrapper.normalFrame()
dateProvider.advance(by:1)
sut.viewControllerViewWillAppear(secondController){
secondController.viewWillAppear(false)}
sut.viewControllerViewDidAppear(secondController){
secondController.viewDidAppear(false)}
fixture.displayLinkWrapper.normalFrame()
dateProvider.advance(by:1)lettimeOfSecondControllerFinishWork= dateProvider.date()
secondController.finishWork()
fixture.displayLinkWrapper.normalFrame()XCTAssertTrue(firstFullDisplaySpan.isFinished)XCTAssertEqual(.deadlineExceeded, firstFullDisplaySpan.status)letsecondFullDisplaySpan=tryXCTUnwrap(secondTracer?.children.first{ $0.operation =="ui.load.full_display"})XCTAssertEqual(secondFullDisplaySpan.timestamp, timeOfSecondControllerFinishWork)}
The text was updated successfully, but these errors were encountered:
The proper solution for this is to extend the reportFullyDisplay method to allow passing in an argument to tell the SDK for which UIViewController fullyDisplay is reported. We still need to figure out what this API looks like, and we should align across all mobile SDKs.
Description
There is a problem with the
reportFullDisplay
API:SentrySDK.reportFullyDisplayed
is called.This will finish TTFD for ViewControllerB, but it is still waiting for its request to respond.
Test inside SentryUIViewControllerPerformanceTrackerTests.swift from #4531 to reproduce the problem:
The text was updated successfully, but these errors were encountered: