Skip to content

Commit 1645a5e

Browse files
etcdctl: add verbose flag to check perf cmd
To allow to get more detail on the perf check, a new verbose flag is added relying on the already existing report package. Signed-off-by: Baptiste Lalanne <baptiste.lalanne@datadoghq.com>
1 parent 638b410 commit 1645a5e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎etcdctl/ctlv3/command/check.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var (
4242
checkDatascalePrefix string
4343
autoCompact bool
4444
autoDefrag bool
45+
verbose bool
4546
)
4647

4748
type checkPerfCfg struct {
@@ -130,6 +131,7 @@ func NewCheckPerfCommand() *cobra.Command {
130131
cmd.Flags().StringVar(&checkPerfPrefix, "prefix", "/etcdctl-check-perf/", "The prefix for writing the performance check's keys.")
131132
cmd.Flags().BoolVar(&autoCompact, "auto-compact", false, "Compact storage with last revision after test is finished.")
132133
cmd.Flags().BoolVar(&autoDefrag, "auto-defrag", false, "Defragment storage after test is finished.")
134+
cmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Print detailed performance report.")
133135
cmd.RegisterFlagCompletionFunc("load", func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
134136
return []string{"small", "medium", "large", "xLarge"}, cobra.ShellCompDirectiveDefault
135137
})
@@ -216,10 +218,12 @@ func newCheckPerfCommand(cmd *cobra.Command, args []string) {
216218
}()
217219

218220
sc := r.Stats()
221+
rc := r.Run()
219222
wg.Wait()
220223
close(r.Results())
221224

222225
s := <-sc
226+
rp := <-rc
223227

224228
attemptCleanup(clients[0], autoCompact)
225229

@@ -229,6 +233,10 @@ func newCheckPerfCommand(cmd *cobra.Command, args []string) {
229233
}
230234
}
231235

236+
if verbose {
237+
fmt.Print(rp)
238+
}
239+
232240
ok = true
233241
if len(s.ErrorDist) != 0 {
234242
fmt.Println("FAIL: too many errors")

0 commit comments

Comments
 (0)