HotKeysStart starts collecting hotkeys data. At least one metric must be specified in args.Metrics. This command is only available on standalone clients.
(ctx context.Context, args *HotKeysStartArgs)
| 57 | // At least one metric must be specified in args.Metrics. |
| 58 | // This command is only available on standalone clients. |
| 59 | func (c *Client) HotKeysStart(ctx context.Context, args *HotKeysStartArgs) *StatusCmd { |
| 60 | cmdArgs := make([]interface{}, 0, 16) |
| 61 | cmdArgs = append(cmdArgs, "hotkeys", "start") |
| 62 | |
| 63 | // Validate that at least one metric is specified |
| 64 | if len(args.Metrics) == 0 { |
| 65 | cmd := NewStatusCmd(ctx, cmdArgs...) |
| 66 | cmd.SetErr(ErrHotKeysNoMetrics) |
| 67 | return cmd |
| 68 | } |
| 69 | |
| 70 | cmdArgs = append(cmdArgs, "metrics", len(args.Metrics)) |
| 71 | for _, metric := range args.Metrics { |
| 72 | cmdArgs = append(cmdArgs, strings.ToLower(string(metric))) |
| 73 | } |
| 74 | |
| 75 | if args.Count > 0 { |
| 76 | cmdArgs = append(cmdArgs, "count", args.Count) |
| 77 | } |
| 78 | |
| 79 | if args.Duration > 0 { |
| 80 | cmdArgs = append(cmdArgs, "duration", args.Duration) |
| 81 | } |
| 82 | |
| 83 | if args.Sample > 0 { |
| 84 | cmdArgs = append(cmdArgs, "sample", args.Sample) |
| 85 | } |
| 86 | |
| 87 | if len(args.Slots) > 0 { |
| 88 | cmdArgs = append(cmdArgs, "slots", len(args.Slots)) |
| 89 | for _, slot := range args.Slots { |
| 90 | cmdArgs = append(cmdArgs, slot) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | cmd := NewStatusCmd(ctx, cmdArgs...) |
| 95 | _ = c.Process(ctx, cmd) |
| 96 | return cmd |
| 97 | } |
| 98 | |
| 99 | // HotKeysStop stops the ongoing hotkeys collection session. |
| 100 | // This command is only available on standalone clients. |
no test coverage detected