net/http/pprof: traces collected from the /debug/pprof/trace endpoint don't include CPU profile samples by default #66679
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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:/debug/pprof/trace
cpuprofiler
?) to the endpoint which, if provided, enables CPU profiling during the trace recordingI 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
The text was updated successfully, but these errors were encountered: