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

Wrong app context view names for screen load transactions #3969

Open
philipphofmann opened this issue May 13, 2024 · 0 comments
Open

Wrong app context view names for screen load transactions #3969

philipphofmann opened this issue May 13, 2024 · 0 comments

Comments

@philipphofmann
Copy link
Member

Platform

iOS

Environment

Develop, TestFlight

Installed

Manually

Version

8.25.2

Did it work on previous versions?

Maybe

Steps to Reproduce

  1. Open iOS-Swift sample app
  2. Check screen load transaction in Sentry

Expected Result

The view_names in the app context should match the transaction name.

Actual Result

The view_names sometimes is UITabBarController or something different. Checkout this sample transaction in Sentry

I guess this is because we add the view_names to the transaction in the client

- (void)addViewNamesToContext:(NSMutableDictionary *)appContext event:(SentryEvent *)event
{
if ([event isKindOfClass:[SentryTransaction class]]) {
SentryTransaction *transaction = (SentryTransaction *)event;
if ([transaction.viewNames count] > 0) {
appContext[@"view_names"] = transaction.viewNames;
}
} else {
appContext[@"view_names"] =
[SentryDependencyContainer.sharedInstance.application relevantViewControllersNames];
}
}

As the SDK captures the transaction on a background thread, the app navigates to a new screen after it captures the auto-generated screen load transaction.

// When a user calls finish on a transaction, which calls captureTransaction, the calling thread
// here could be the main thread, which we only want to block as long as required. Therefore, we
// capture the transaction on a background thread.
__weak SentryHub *weakSelf = self;
[self.dispatchQueue dispatchAsyncWithBlock:^{
[weakSelf captureEvent:transaction
withScope:scope
additionalEnvelopeItems:additionalEnvelopeItems];
}];
}

Are you willing to submit a PR?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant