Additional review fixes from PR

Signed-off-by: Evans Mungai <mbuevans@gmail.com>
pull/13481/head
Evans Mungai 10 months ago
parent baf8bffc12
commit af622e8887
No known key found for this signature in database
GPG Key ID: BBEB812143DD14E1

@ -284,13 +284,13 @@ Small, ad-hoc changes/PRs to Helm which introduce user facing changes, which wou
### Testing PRs
During development, you need to add automated tests where possible. There are a few `make test*` targets that you can use to execute your unit or integration tests. If your contribution requires profiling to check memory and/or CPU usage, you can use `--cpuprofile` and/or `--memprofile` global cli flags to run collect runtime profiling data for analysis. You can use Golang's [pprof](https://github.com/google/pprof/blob/main/doc/README.md) tool to inspect the profiling data.
During development, you need to add automated tests where possible. There are a few `make test*` targets that you can use to execute your unit or integration tests. If your contribution requires profiling to check memory and/or CPU usage, you can use `--cpuprofile` and/or `--memprofile` global cli flags to collect runtime profiling data for analysis. You can use Golang's [pprof](https://github.com/google/pprof/blob/main/doc/README.md) tool to inspect the results.
Example invocation that collects profiling data
Example analysing collected profiling data
```
helm show all bitnami/nginx --memprofile mem.prof --cpuprofile cpu.prof
# Visualize graphs. You need to have installed graphviz in you system
# Visualize graphs. You need to have installed graphviz package in your system
go tool pprof -http=":8000" cpu.prof
```

@ -1,4 +1,18 @@
// Profile CPU and memory usage of Helm commands
/*
Copyright The Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main

@ -95,7 +95,7 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string
Short: "The Helm package manager for Kubernetes.",
Long: globalUsage,
SilenceUsage: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
cpuprof, err := cmd.Flags().GetString("cpuprofile")
if err != nil {
log.Printf("Warning: Failed to get cpuprofile flag: %v", err)
@ -105,7 +105,7 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string
log.Printf("Warning: Failed to start profiling: %v", err)
}
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
PersistentPostRun: func(cmd *cobra.Command, _ []string) {
memprof, err := cmd.Flags().GetString("memprofile")
if err != nil {
log.Printf("Warning: Failed to get memprofile flag: %v", err)

Loading…
Cancel
Save