diff --git a/cmd/admin-scanner-trace.go b/cmd/admin-scanner-trace.go index c35cb51a..eac2b9ff 100644 --- a/cmd/admin-scanner-trace.go +++ b/cmd/admin-scanner-trace.go @@ -28,6 +28,10 @@ import ( ) var adminScannerTraceFlags = []cli.Flag{ + cli.BoolFlag{ + Name: "verbose, v", + Usage: "print verbose trace", + }, cli.StringFlag{ Name: "response-threshold", Usage: "trace calls only with response duration greater than this threshold (e.g. `5ms`)", @@ -40,6 +44,10 @@ var adminScannerTraceFlags = []cli.Flag{ Name: "node", Usage: "trace only matching servers", }, + cli.StringSliceFlag{ + Name: "path", + Usage: "trace only matching path", + }, } var adminScannerTraceCmd = cli.Command{ @@ -73,7 +81,7 @@ EXAMPLES: func checkAdminScannerTraceSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { - cli.ShowCommandHelpAndExit(ctx, "trace", 1) // last argument is exit code + cli.ShowCommandHelpAndExit(ctx, ctx.Command.Name, 1) // last argument is exit code } } diff --git a/cmd/admin-trace.go b/cmd/admin-trace.go index 4ef29b69..c2d4ecae 100644 --- a/cmd/admin-trace.go +++ b/cmd/admin-trace.go @@ -49,7 +49,7 @@ var adminTraceFlags = []cli.Flag{ Name: "call", Usage: "trace only matching Call types (values: `s3`, `internal`, `storage`, `os`, `scanner`, `decommission`)", }, - cli.StringFlag{ + cli.DurationFlag{ Name: "response-threshold", Usage: "trace calls only with response duration greater than this threshold (e.g. `5ms`)", }, @@ -218,15 +218,8 @@ func matchTrace(opts matchOpts, traceInfo madmin.ServiceTraceInfo) bool { // Calculate tracing options for command line flags func tracingOpts(ctx *cli.Context, apis []string) (opts madmin.ServiceTraceOpts, e error) { - if t := ctx.String("response-threshold"); t != "" { - d, e := time.ParseDuration(t) - if e != nil { - return opts, fmt.Errorf("Unable to parse threshold argument: %w", e) - } - opts.Threshold = d - } - opts.OnlyErrors = ctx.Bool("errors") + opts.Threshold = ctx.Duration("response-threshold") if ctx.Bool("all") { opts.S3 = true