-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
UI Button click creates unexpected trace #4129
Comments
Thanks for testing and documenting this scenario, this doesn't seem intuitive. Though there might be a historic/technical reason for that behaviour I'm not aware of. My gut feeling is - this might be related to the way we instrument user UI interactions, i.e. the button click. We need to create an idle transaction for this because the action doesn't have a clear end (like a navigation would have), so we might not be able to use the manual tx (or another automatic tx) to instrument that. To narrow down the problem field, did/can you try what happens if you trigger the ANR via e.g. a navigation or something else that starts an auto tx? Also, what would happen if the initial manual tx is instead an auto tx? |
I wonder if this comes out of the fact that SentryTracer was originally used for managing the idle timeout, and then only later did we refactor SentryTracer to be a subclass of SentrySpan. In my mind, every automatic UI interaction should be a span. I'm not sure where we're at with performanceV2, but that simplifies things a bunch for this: in V1, maybe it's the case that such a span wouldn't be recorded if there's no current trace. But in V2 we would record every such span. I guess maybe I should also try this with the perfV2 option enabled, as well as what you suggested. |
I think the reason is that the manual transaction started here isn't bound to the scope.
You can do this by changing the code to
Then, the ANR should be linked to the manual transaction as the SDK doesn't bind the UI event transaction to the scope. sentry-cocoa/Tests/SentryTests/Integrations/UIEvents/SentryUIEventTrackerTests.swift Lines 144 to 150 in 061c982
|
Description
I tried testing how to get from an ANR issue to a profile. But the sample app UX and client behavior combined to produce an unexpected result.
Repro steps
Expected result
Ideally, the profile should be linked right from the ANR. There is a field for us to do so, but I haven't been able to get an actual profile link to show up there yet.
Barring that, I should be able to go from the ANR issue (https://sentry-sdks.sentry.io/issues/5485507710/?project=5428557&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=1m&stream_index=0) to the trace, which would then have profiling data displayed inline or a link to the profile (here's the actual profile it should've been associated with: https://sentry-sdks.sentry.io/profiling/profile/sentry-cocoa/2bba13dac5a044fba93eaff0c19b8266/flamegraph/?colorCoding=by+system+vs+application+frame&query=&sorting=call+order&tid=259&view=top+down)
I expected this structure:
Observed result
No profile is linked directly on the ANR.
But, for the actual point of this ticket, when I went to the trace for the ANR, it was not the trace for the manual transaction I'd started. It was for a separate trace for the automatic UIButton click. I would've expected that to at least be a child span on the manual transaction that I started. But I can't find a way to traverse from one to the other to connect the pathway from the ANR to the profile.
It appears what actually happened is something more like this:
The text was updated successfully, but these errors were encountered: