Description
The runtime execution tracer records CPU profiler samples if the CPU profiler is running during tracing. Having these samples contextualized in a trace is very useful. However, if I collect an execution trace via the /debug/pprof/trace
endpoint, that execution trace will not include CPU profile samples by default. Currently I have to hit the /debug/pprof/profile
endpoint simultaneously to activate CPU profiling, or otherwise arrange for it to be activated at the right time, to get this data in the trace. I think we should just have the /debug/pprof/trace
endpoint turn on CPU profiling. I see two ways to go about this:
- Turn on CPU profiling unconditionally in
/debug/pprof/trace
- Add a query parameter (
cpuprofiler
?) to the endpoint which, if provided, enables CPU profiling during the trace recording
I can't think of a reason why I wouldn't want CPU profile samples in an execution trace, so I might be inclined to option 1. However, having it on unconditionally would conflict with a user collecting a CPU profile via /debug/pprof/profile
simultaneously: whichever endpoint call completes first would presumably stop CPU profiling, interfering with the other endpoint call. So perhaps option 2 is better?
cc @mknyszek
Metadata
Metadata
Assignees
Labels
Type
Projects
Status