blitztrace - run in 60 second sample mode by default
by default have sp_blitztrace start the trace, wait 60 seconds, query results, stop the trace, delete the trace.
if users want to just start it or stop it, they have to use a special parameter combo. (I want to leave that in there because it's nice for demo purposes.)
Closed as: Won't fix.
I wrote a bunch of code to implement this, but found that it's just not a good idea because of the way extended events are implemented.
To do this, you have to create a trace, start the trace, and then do a waitfor. The problem is that if anything happens to make the script fail during the waitfor (getting disconnected or hitting some kind of bug after the waitfor but before it's done), an orphan trace is left running.
Extended Events doesn't have a maximum run time we can set when we start a trace. We can set the maximum number of rollover files (which we're doing), but reaching the limit doesn't stop the trace-- it just keeps going and re-writing over the files while maintaining that number.
So it's simpler to just implement: start, stop, read, drop
... And document clearly that users are responsible for stopping traces.
the duration thing is easy to do with a series of commands:
exec sp_BlitzTrace @Action='start' (other params) waitfor delay exec sp_BlitzTrace @Action='stop' exec sp_BlitzTrace @Action='read' exec sp_BlitzTrace @Action='drop'