firebase-android-sdk
firebase-android-sdk copied to clipboard
Cancel/Discard Started Performance Custom Traces 🚀
What feature would you like to see?
Possibility to discard/cancel custom Firebase Performance trace. Currently we can only start and stop trace which always will track time. eg.
val myTrace = Firebase.performance.newTrace("test_trace")
myTrace.start()
// code that you want to trace
myTrace.stop()
But if for some reason I want to discard started trace (example scenario: I want to trace how long app fetches data from api but some error occurs and I don't want to track partially downloaded data). I cannot do it and I have to live with started trace which takes memory on device.
How would you use it?
I think adding method Trace#cancel()
which under the hood will unsubscribe from all observations would be best solution.
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Cmon guys, don't act like tinder girls, please don't ghost me.
Hi @PiotrBandurski, sorry for the unintended radio silence here. We really appreciate you filing the feature request and following up on this. However, we can't promise any timeline for this feature, our engineers will take a look into it once they have the time. if you have additional information you'd like to share, let us know.
And for others who find this useful, adding an emoji thumbs up on the author's post can help our engineers prioritize adding this to the roadmap. Thanks!
Agreed, this functionality would support our use-cases as well.
We have several traces that become invalid through the course of the app depending on user actions. Today, we simply don't call stop
on them, but would much rather have an explicit API to discard these. On iOS, I see the private API for cancel, although I'm not sure if that has the same effect as discard
or invalidate
would.
In past I even created pr for this issue but it seems that it expried and was rejected. Here code for new pr. https://github.com/PiotrBandurski/firebase-android-sdk/commit/1653da17550cf97a2062529eaf7dd2ea405fa2b4
Any update on this? Current we can just not call the stop() method then set the Trace to null. But it looks ugly and I'm not too sure if it has any side effects that can affect the trace.
Any update on this? Current we can just not call the stop() method then set the Trace to null. But it looks ugly and I'm not too sure if it has any side effects that can affect the trace.
When you call stop the SDK records the trace, setting it to null will do nothing because it is too little too late. At least this appears to be the case for iOS: https://github.com/firebase/firebase-ios-sdk/blob/main/FirebasePerformance/Sources/Timer/FIRTrace.m#L170
Any updates on it? I even created a pull request for it. @argzdev