embrace-android-sdk
embrace-android-sdk copied to clipboard
Fall back to heartbeat time when converted span snapshots
Goal
Use the last heartbeat time of the session span if the end time was missing, like if the session itself wasn't terminated properly, like during a native crash or a user kill while the app is in background.
Previously we were assuming that there's always an end time, and we even tested for that case too, which yield and end of 0 in those cases. The backend is able to work with that in most case, as it just figures it out by looking at other timestamps. So while customers don't see this problem for the most part, like for sessions associated with native crashes, the session span is wrong. I was also seeing some 0-length sessions for background kills where the session span contains a heartbeat time, so it's better than we do this population properly, and test it properly as well.
Testing
Modify and extend unit test on the EmbraceDeliveryService
. Tweaking some testing infra to make this easier too.