StartInstrumentation instruments CLI commands with the individual metrics and spans configured. It's the main command OTel utility, and new command-related metrics should be added to it. It should be called immediately before command execution, and returns a stopInstrumentation function that must be
(cmd *cobra.Command)
| 69 | // It should be called immediately before command execution, and returns a stopInstrumentation function |
| 70 | // that must be called with the error resulting from the command execution. |
| 71 | func (cli *DockerCli) StartInstrumentation(cmd *cobra.Command) (stopInstrumentation func(error)) { |
| 72 | baseAttrs := BaseCommandAttributes(cmd, cli) |
| 73 | return startCobraCommandTimer(cli.MeterProvider(), baseAttrs) |
| 74 | } |
| 75 | |
| 76 | func startCobraCommandTimer(mp metric.MeterProvider, attrs []attribute.KeyValue) func(err error) { |
| 77 | meter := getDefaultMeter(mp) |
no test coverage detected