K8s: fix tracer init by moving Config() above it (#90311)

This commit is contained in:
Charandas 2024-07-10 14:57:58 -07:00 committed by GitHub
parent a28db90dd5
commit 57e2a56876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,15 +74,17 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{}
return err return err
} }
if o.Options.TracingOptions.TracingService != nil { // o.Config(tracer) definitely needs to happen before we override the tracer below
tracer.InitTracer(o.Options.TracingOptions.TracingService) // using tracer.InitTracer with the real tracer
}
config, err := o.Config(tracer) config, err := o.Config(tracer)
if err != nil { if err != nil {
return err return err
} }
if o.Options.TracingOptions.TracingService != nil {
tracer.InitTracer(o.Options.TracingOptions.TracingService)
}
defer o.factory.Shutdown() defer o.factory.Shutdown()
if err := o.RunAPIServer(config, stopCh); err != nil { if err := o.RunAPIServer(config, stopCh); err != nil {