-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add debug_zip_command_flags.txt file in debug zip #129785
cli: add debug_zip_command_flags.txt file in debug zip #129785
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @aa-joshi and @angles-n-daemons)
pkg/cli/zip.go
line 371 at r1 (raw file):
s = zr.start("capture debug zip flags") if err := z.createJSON(s, zc.prefix+"/debug_zip_command_flags.json", zipCtx); err != nil {
Have you considered reading the provided args from *cobra.Command
? it will have all the flags that the user passed. That would significantly reduce the size of the diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @angles-n-daemons and @arjunmahishi)
pkg/cli/zip.go
line 371 at r1 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
Have you considered reading the provided args from
*cobra.Command
? it will have all the flags that the user passed. That would significantly reduce the size of the diff.
Thanks for the suggestion! I did explore that cobra command. The challenge with that is we have to iterate over flags to fetch the value & dump into file.
Coming back to diff, The only change is to export field for generating json file. Most of the files are from test case updates.
I can split test & code changes in different commits.
Let me know your thoughts.
Should be pretty straightforward. I think there is a helper function specifically built for this kind of usecase. cmd.Flags().VisitAll(func(f *pflag.Flag) {
if f.Changed {
// this condition is true only if the user has set the flag
// add to a string builder
}
}) Other than the diff size, IMO this is a safer change. Sometimes toggling a struct field between exported/un-exported can have unexpected side effects. Either way, I think it will be good to add a datadriven test that asserts the file generated. |
f53d34b
to
84d261c
Compare
84d261c
to
1646471
Compare
Previously, debug zip doesn't have any way of determining the flags set during command execution. It is a pain point for support team to figure out flag values passesd during debug zip generation. To address this, we have added `debug_zip_command_flags.txt` file in debug zip. It captures flag values set during command execution. Epic: CRDB-32134 Release note: None
1646471
to
24c42b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @angles-n-daemons and @arjunmahishi)
pkg/cli/zip.go
line 371 at r1 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
The challenge with that is we have to iterate over flags to fetch the value & dump into file.
Should be pretty straightforward. I think there is a helper function specifically built for this kind of usecase.
cmd.Flags().VisitAll(func(f *pflag.Flag) { if f.Changed { // this condition is true only if the user has set the flag // add to a string builder } })Other than the diff size, IMO this is a safer change. Sometime toggling a struct field between exporter/un-exported can have unexpected side effects.
Either way, I think it will be good to add a datadriven test that asserts the file generated.
Suggested changes are updated in latest commit. PTAL. TIA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @aa-joshi and @angles-n-daemons)
pkg/cli/zip.go
line 336 at r2 (raw file):
// the profiles. { s := zc.clusterPrinter.start("pprof summary script")
Last question: Was this an intentional change? Removing the :
(increasing the scope of s
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @angles-n-daemons and @arjunmahishi)
pkg/cli/zip.go
line 336 at r2 (raw file):
Previously, arjunmahishi (Arjun Mahishi) wrote…
Last question: Was this an intentional change? Removing the
:
(increasing the scope ofs
)
Yes, it is intentional. nogo
was throwing error due to re initialisation of s
.
TFTR! bors r+ |
Build failed: |
unit_tests passed on re-try. bors r+ |
Previously, debug zip doesn't have any way of determining the flags set during command execution. It is a pain point for support team to figure out flag values passesd during debug zip generation. To address this, we have added
debug_zip_command_flags.txt
file in debug zip. It captures flag values set during command execution.Epic: CRDB-32134
Release note: None