Skip to content

FR: Callable function on Trace object that lets us cancel the trace without logging it, rather than using stop #1951

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

Open
willbattel opened this issue Oct 15, 2018 · 4 comments

Comments

@willbattel
Copy link

Sometimes if the ViewController changes while a trace is in progress, we want to abandon the trace as the VC may or may not finish the process we're tracking. Calling stop() on the trace will log an incomplete trace, which is not what we want as it will negatively affect the average elapsed time reported in the console. I couldn't find any indication that this feature already exists, but it'd be great if we could call something like cancel() on the trace to abort it without logging the results. Basically the same thing as stop() just without the reporting to Firebase.

Thanks!

@dangthaison91
Copy link

Hi @morganchen12 , as this request is opened for a long time, could you please share any progress?

@morganchen12
Copy link
Contributor

@visumickey do you have time to draft up a design? This feature shouldn't require any backend changes.

@willbattel
Copy link
Author

We're still interested in this behavior. @morganchen12 I know you guys are busy, but do you think this is something we might get some day or is it more likely this will sit here until the heat-death of our universe? 🙃

In the mean time, can you recommend this as a workaround or is there a possible danger to orphaning the trace?

var exampleTrace: Trace? = Performance.startTrace(name: "exampleTrace")

// Cancel current trace
exampleTrace = nil

// Start a new trace
exampleTrace = Performance.startTrace(name: "exampleTrace")

@morganchen12
Copy link
Contributor

The FIRTrace class already has cancel method, so the best workaround would be to just expose that method in a category and call it directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants