-
Notifications
You must be signed in to change notification settings - Fork 464
ddtrace/opentracer: implement Context Extension #855
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
ddtrace/opentracer: implement Context Extension #855
Conversation
I can't set the milestone btw. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very interesting. We'll have to run some tests. I'm hoping to get a chance to look at it soon. This could potentially solve a big limitation if it does what it claims it does 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think it's fine to do this. AFAIU this simply adds more context into the uhm... context 🙂
@gbbr for what its worth, this only solves part of the problem. This allows using opentracing as a parent for DD spans, but no ability to use a DD span as a parent for opentracing spans. This is because DD span needs to call |
This actually means that barring a significant change to support that (I tried and failed without having to rewrite a bunch of stuff), we'll be moving off ddtrace completely and adopting opentracing only. |
I still find this to be a useful change and hope we can merge it even though it only solves half the issue. While it would be great if we could also implement something to work in the other direction, this still allows us to use some of the extensions (such as database tracing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine by me to merge. We are currently in code freeze so I'll leave it here until that ends, and merge it afterwards.
@gbbr for what its worth, this only solves part of the problem. This allows using opentracing as a parent for DD spans, but no ability to use a DD span as a parent for opentracing spans.
This is because DD span needs to call opentracing.ContextWithSpan in order for that work.
@shannontan-bolt I see. I'm happy for us to fix that, if we can work around some restrictions. For us, it was a hard requirement that the Datadog tracer (ddtrace
package) never imports opentracing
. If we can solve this somehow and keep this requirement, I'm open.
@gbbr - I don't see any good way of doing that since somehow, you'll need to set the context within One thought I had, but no good way to do it is: when ddtrace is used with opentracing, actually use the |
@gbbr - when is the code freeze over? Since this is a blocker for me a bit, I might need to fork this temporarily if the code freeze/time to release is a while. |
If you don't mind, please go ahead and fork it. It will be a good way to test. Code freeze is over in about a week generally if all goes well, but then we'll still have to wait again until the next version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I assume you've tested it and it does what you expect it to :)
c68fa21
to
e576811
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a few nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shannontan-bolt would love to get this merged for you, are you still interested in doing the last few final changes?
Co-authored-by: Gabriel Aszalos <gabriel.aszalos@datadoghq.com>
Co-authored-by: Gabriel Aszalos <gabriel.aszalos@datadoghq.com>
ca55feb
to
7239b9c
Compare
@shannontan-bolt since this was a popular PR and haven't heard back from you, I took the liberty to commit into your PR. I hope that's ok. |
@gbbr that's awesome, thanks! |
* 'v1' of https://github.com/DataDog/dd-trace-go: Implement DD_PROFILING_OUTPUT_DIR for dev/debug (DataDog#924) contrib/go-pg/pg.v10: add INTEGRATION flag check for tests (DataDog#921) contrib/go-redis/redis.v8: optimize BeforeProcess and BeforeProcessPipeline (DataDog#920) CI: check go.sum is up-to-date (DataDog#918) README: Fix go get instructions (DataDog#913) internal/log: Improve API for testing (DataDog#916) ddtrace/tracer: add support for agent discovery endpoint, feature flags, stats & drops (DataDog#859) internal/version: bump to v1.31.0 (DataDog#910) CONTRIBUTING.md: add link to contrib/README.md (DataDog#802) profiler: Disable agentless mode for WithAPIKey (DataDog#906) contrib/Shopify/sarama: fix possible deadlock in WrapAsyncProducer (DataDog#907) contrib/database/sql.tracedConn implement driver.SessionResetter (DataDog#908) ddtrace/opentracer: consider FollowsFrom references as children (DataDog#905) ddtrace/opentracer: add support for opentracing.TracerContextWithSpanExtension (DataDog#855) ddtrace/tracer: follow noDebugStack setting when using SetTag with an error (DataDog#900) contrib/net/http: add a getter to retrieve original round tripper (DataDog#903) ddtrace/tracer: ensure Flush call is synchronous (DataDog#901)
Solves #813.
This implements the OpenTracing context extension. If a span was started by a Datadog OpenTracer, then the underlying object should be a pointer to a
opentracer.span
. If that is the case, we're able to use the context with the underlying Datadog Span (of the opentracer.span).I've tested this locally to connect opentracing spans with Datadog spans assuming I set the
opentracing.SetGlobalTracer(datadogOpenTracer)
.