proposal: net/http/pprof: support finer-grained delta computation #57765
Labels
FeatureRequest
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Proposal
Milestone
The
/debug/pprof
endpoint supports a "seconds" parameter. When a non-CPU profile is requested with that parameter, the endpoint returns a profile representing the difference ("delta") between two of those profiles taken "seconds" apart. The current delta implementation computes that difference for every value in a sample. In particular, the heap profile will contain differences foralloc_space
andalloc_objects
, as well as theinuse_space
andinuse_objects
counts.On the one hand, I can see how seeing the change in
inuse_space
orinuse_objects
could aid memory leak debugging. On the other hand, there's another use case for getting the delta profiles: aggregation. The Datadog and Google Cloud Profiler client libraries compute deltas, but only for thealloc_space
andalloc_objects
values in a heap profile. For theinuse
values, the most recent value is used rather than the difference. Those values are preferable for computing averages across several profiles.Both of those libraries use
runtime/pprof
and manipulate the profiles locally to get the desired result. But for profiling services by pulling from the/debug/pprof
endpoints, you'd need to do something like pull two profiles and compute the delta later. Perhaps there can be an option to request delta profiles where some of the sample values have deltas computed, but others don't? Admittedly, this would primarily be an optimization to avoid having to request multiple profiles. See this example for how it might be implemented, by adding another query parameterdelta_value
to specifies which values in the profile to compute deltas for.The text was updated successfully, but these errors were encountered: