[VC-35738] Move the pprof endpoints to the main HTTP server rather than starting a second server #600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The pprof server was being started on a second HTTP server running in an unmanaged Go routine.
It used log.Fatal on exit to bring down the process in the event of an error in that server.
Moving the pprof endpoints to the main HTTP server simplifies the code because it avoids having to manage a second server.
It will make it easier to enable TLS on these endpoints in future, if that is desired, because only a single TLS certificate will be required.
It makes life easier for platform admins who will have one less TCP port to worry about.
It removes one more instance of
log.Fatal
, which are scattered all over the run command and moves us closer to removing the use of the legacylog
module and handling all sub-command errors in a consistent way.These changes have been extracted from a larger prototype PR: #593 for the sake of easy review.
The
--enable-pprof
feature was originally added by @tfadeyi in #286 to aid the investigation of the high memory usage of the agent.xref: