MCPcopy Index your code
hub / github.com/docker/cli / StartInstrumentation

Method StartInstrumentation

cli/command/telemetry_utils.go:71–74  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
71func (cli *DockerCli) StartInstrumentation(cmd *cobra.Command) (stopInstrumentation func(error)) {
72 baseAttrs := BaseCommandAttributes(cmd, cli)
73 return startCobraCommandTimer(cli.MeterProvider(), baseAttrs)
74}
75
76func startCobraCommandTimer(mp metric.MeterProvider, attrs []attribute.KeyValue) func(err error) {
77 meter := getDefaultMeter(mp)

Callers 2

RunPluginFunction · 0.80

Calls 3

MeterProviderMethod · 0.95
BaseCommandAttributesFunction · 0.85
startCobraCommandTimerFunction · 0.85

Tested by

no test coverage detected