"Paused" span for a fragment incorrectly becomes parent of future spans after exiting activity
Observed this using the demo app, where we recently implemented an activity (AboutActivity.kt) with fragments. Upon exiting the activity, the Paused span for the last fragment (with fragmentPaused and fragmentStopped events), which is a child of the activity's Paused span, incorrectly becomes the parent for unrelated future spans not connected to the fragment or activity.
Below is a screenshot from the Jaeger UI with the relevant spans expanded:
In the screenshot, the
Created, Paused etc spans under the expanded ones are for different activities, and logo.clicked is a custom span emitted after clicking a button on the main screen.
To reproduce this behaviour:
- In the demo app, click "Learn more" on the main screen.
- Exit the activity with fragments by selecting "Exit" from the bottom navigation bar.
- Click around the app to generate new spans.
It seems to me that simply ending the Paused span and creating a new Stopped span for fragmentStopped resolves this issue and i'll submit a pr for this.