feat(cli): Ca: tools for use by pprof
for serialization.
#3647
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.
This PR adds the ability to dump pprof data to logs for debugging.
This is a continuation of #3454
This is one of 4 PRs in a PR train:
aaron-kasten/kopia:pprof-extensions-A
aaron-kasten/kopia:pprof-extensions-B
aaron-kasten/kopia:pprof-extensions-C
aaron-kasten/kopia:pprof-extensions-D
Usage
pprof dumps are configured using the
KOPIA_DEBUG_PPROF
environment variable. The variable is a list of pprof profile names (seepprof.Lookup
) separated by,
. Optional parameters can be set with '=', delimited by ':'.example:
export KOPIA_DEBUG_PPROF=cpu,heap=debug=1,mutex=debug=1:rate=1000
The above setting will produce CPU, heap and mutex profiles. The block profile will have its debug parameter set to 1 and its sample rate set to 1000
Once run, profile data will be output in the Kopia logs on termination. Profile dumps are generated as base64 output (PEM) to the log on termination.
You should consider captureing logs to a file when running the Kopia command:
Once the logs are captured, a dump can created by terminating the command:
The following signals (on Linux and macos) can be used to dump profiles: SIGTERM, SIGINT, and SIGUSR1.
Captured standard-output should look similar to:
The captured output can then be converted to a pprof binary by using
kats
. The Kopiakats
tool can be used to convert the PEM file into a binary:When successful, kats will output the file found in the capture file.
kats expects that there is a well formed PEM record in the capture file.
Once successful, the binary can be used in PPROF:
Configuration Options
TBDThis PR adds the ability to dump pprof data to logs for debugging.
This is a continuation of #3454
This is one of 4 PRs in a PR train:
aaron-kasten/kopia:pprof-extensions-A
aaron-kasten/kopia:pprof-extensions-B
aaron-kasten/kopia:pprof-extensions-C
aaron-kasten/kopia:pprof-extensions-D
Usage
pprof dumps are configured using the
KOPIA_DEBUG_PPROF
environment variable. The variable is a list of pprof profile names (seepprof.Lookup
) separated by,
. Optional parameters can be set with '=', delimited by ':'.example:
export KOPIA_DEBUG_PPROF=cpu,heap=debug=1,mutex=debug=1:rate=1000
The above setting will produce CPU, heap and mutex profiles. The block profile will have its debug parameter set to 1 and its sample rate set to 1000
Once run, profile data will be output in the Kopia logs on termination. Profile dumps are generated as base64 output (PEM) to the log on termination.
You should consider captureing logs to a file when running the Kopia command:
Once the logs are captured, a dump can created by terminating the command:
The following signals (on Linux and macos) can be used to dump profiles: SIGTERM, SIGINT, and SIGUSR1.
Captured standard-output should look similar to:
The captured output can then be converted to a pprof binary by using
kats
. The Kopiakats
tool can be used to convert the PEM file into a binary:When successful, kats will output the file found in the capture file.
kats expects that there is a well formed PEM record in the capture file.
Once successful, the binary can be used in PPROF:
Configuration Options
TBD