Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTracing bridge: BridgeTracing warns about deferred context setup, but how can this be avoided? #2142

Open
yvrhdn opened this issue Jul 29, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed pkg:bridges Related to a bridge package

Comments

@yvrhdn
Copy link
Contributor

yvrhdn commented Jul 29, 2021

Description

I'm missing some documentation or examples of correct usage of the OpenTracing bridge. (I don't mind contributing this, but I'm not sure if my setup is correct.)

This is our code:

tp := tracesdk.NewTracerProvider(
	// ...
)
otel.SetTracerProvider(tp)

// ... omitted defer func to shutdown tp ...

// Install the OpenTracing bridge
bridgeTracer, _ := opentracing.NewTracerPair(tp.Tracer("OpenTracing"))
bridgeTracer.SetWarningHandler(func(msg string) {
	// ...
})
ot.SetGlobalTracer(bridgeTracer)

When I run this I always get the following warning:

SDK should have deferred the context setup, see the documentation of go.opentelemetry.io/otel/bridge/opentracing/migration

This is emitted by BridgeTracer when the context was modified by its OTel tracer.
The BridgeTracer is using an instance of WrapperTracer, which respects the skip context setup.
But I noticed WrapperTracer itself calls another tracer. What is stopping this tracer from modifying the context it returns?

In fact, the tracer in sdk/trace modifies the context and is thus not compatible I guess?

Is this warning thus unavoidable? Our exported traces seem fine so I'm not sure what to do with this warning.

@yvrhdn yvrhdn added the bug Something isn't working label Jul 29, 2021
@MrAlias MrAlias added help wanted Extra attention is needed pkg:bridges Related to a bridge package labels May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed pkg:bridges Related to a bridge package
Projects
Status: High priority
Development

No branches or pull requests

2 participants