lightstep / lightstep-tracer-android

The Lightstep distributed tracing library for Android.
https://lightstep.com
MIT License
8 stars 1 forks source link

What happens if a span does not ever finish? #43

Open jeffkelsey opened 4 years ago

jeffkelsey commented 4 years ago

If we start a span for a long running network request within an android activity or fragment as an example, what happens if the activity/fragment is stopped/interupted (lets say by a phone call or the user manually backing out of the app) before the corresponding span has finished? Do we need to clean up any still running spans by finishing them as part of the activity onDestroy callback?

Most modern sdks will handle this by making them "lifecycle aware" (https://developer.android.com/topic/libraries/architecture/lifecycle) so that we could pass a lifecycle object along with the trace (In this example, an activity or fragment) so that lightstep sdk would know to finish or cancel the span automatically as opposed to requiring the client to perform cleanup . Is this something we could request as a future enhancement or is already handled someway internally?