Skip to content

Commit

Permalink
profiler: deprecate PprofDiff (#1806)
Browse files Browse the repository at this point in the history
The PprofDiff function was added to our public API unintentionally as
part of #1511. The function is only meant for internal use. This was
missed during code review, likely due to the size of the change and the
fact that most of our attention was devoted to making sure the core
parts of the change were implemented correctly.

Mark the function as deprecated, to be removed in a later release.
This should hopefully give users a chance to notice that it's going away
and stop using it before it's removed. pkg.go.dev will show that the
the function is deprecated, and some IDEs and linters will flag use of
deprecated functions.

This is an exception to our normal v1 compatibility guarantees. It is
very unlikely that any of our users depend on this function. It serves
no purpose in the context of the profiler's public API, and anybody who
might have a reason to use this function would probably have already
found a way to do what they want using the
github.com/google/pprof/profile package.
  • Loading branch information
nsrip-dd committed Mar 16, 2023
1 parent 7686ff9 commit 96b9f30
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions profiler/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@ func (cdp *comparingDeltaProfiler) reportError(error string, extraTags ...string
// profile. Samples that end up with a delta of 0 are dropped. WARNING: Profile
// a will be mutated by this function. You should pass a copy if that's
// undesirable.
//
// Deprecated: This function was introduced into our public API unintentionally.
// It will be removed in the next release. If you need this functionality,
// it can be implemented in two lines:
//
// a.Scale(-1)
// return pprofile.Merge([]*pprofile.Profile{a, b})
func PprofDiff(a, b *pprofile.Profile) (*pprofile.Profile, error) {
a.Scale(-1)
return pprofile.Merge([]*pprofile.Profile{a, b})
Expand Down

0 comments on commit 96b9f30

Please sign in to comment.