mirror of https://github.com/docker/cli.git
Merge pull request #5457 from laurazard/backport-dropped-defer
[27.x backport] telemetry: fix early meterprovider shutdown
This commit is contained in:
commit
f05200311d
|
@ -360,9 +360,11 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
|
||||||
|
|
||||||
mp := dockerCli.MeterProvider()
|
mp := dockerCli.MeterProvider()
|
||||||
if mp, ok := mp.(command.MeterProvider); ok {
|
if mp, ok := mp.(command.MeterProvider); ok {
|
||||||
if err := mp.Shutdown(ctx); err != nil {
|
defer func() {
|
||||||
otel.Handle(err)
|
if err := mp.Shutdown(ctx); err != nil {
|
||||||
}
|
otel.Handle(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
|
fmt.Fprint(dockerCli.Err(), "Warning: Unexpected OTEL error, metrics may not be flushed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue