-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
bridge/opentracing: introduce NewTracerProvider that wraps TracerProvider instead of Tracer #3116
bridge/opentracing: introduce NewTracerProvider that wraps TracerProvider instead of Tracer #3116
Conversation
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3116 +/- ##
=====================================
Coverage 78.9% 78.9%
=====================================
Files 169 170 +1
Lines 12437 12460 +23
=====================================
+ Hits 9813 9836 +23
Misses 2415 2415
Partials 209 209
|
While this makes sense, it creates a new wrapped tracer every time |
The wrapped tracer is a very lightweight struct, and the creation of the underlying However @dmathieu I can implement a similar approach here when creating wrapped tracers if that would make this change acceptable! |
Thank you. I'm personally not super fond of the name |
What do you think about the name Alternatively, maybe a simple
I can add a deprecation godoc to the other constructor! |
You're right, |
d53de5d
to
59f2c6b
Compare
59f2c6b renames the constructor and adds a deprecation notice to It might be valuable to provide new variants of
We could also introduce new naming like:
Alternatively, we could also deprecate the utilities entirely and rely on users to replicate the setup themselves. Let me know what you think! |
hey @dmathieu, any chance this PR might get another round of reviews? The lack of appropriate |
Co-authored-by: Damien Mathieu <[email protected]>
Thanks for the review @dmathieu - addressed your last comment, and all checks seem to be green :) (I'm not authorized to merge, so would appreciate some help with that 🙏 ) |
…0945) The existing wrapped OpenTelemetry TracerProvider for bridging OpenTracing API calls to OpenTelemetryAPI calls discards the name provided to the `Tracer()` constructor on it, since it uses a fixed tracer that we provide it. This change leverages an upstream patch, open-telemetry/opentelemetry-go#3116 (dependency update: https://github.com/sourcegraph/sourcegraph/pull/47126), that allows wrapped tracers to be created on the fly with the provided parameters, so that we can more accurately see the instrumentation source. ## Test plan Via the bridge, we can see that the Tracer used is the bridge tracer: <img width="1322" alt="image" src="https://user-images.githubusercontent.com/23356519/186957763-60faee32-e6a5-4bda-bb64-fddb82eacc0d.png"> Via direct usage of OpenTelemetry, we can see that the Tracer used has the custom name set: <img width="1448" alt="image" src="https://user-images.githubusercontent.com/23356519/186957773-c6ff7643-3f89-498d-857b-1dd79b36508d.png">
Currently, using the OpenTracing bridge tracer pairs, e.g.
NewTracerPair
, means that all tracing is named with the tracer initially provided toWrappedTracerProvider
- calls toTrace()
with names and options always returns the same tracer.This change creates a new
opentracing.TracerProvider
to allow it to accepttrace.TracerProvider
s and create named/configured tracers dynamically with bridging configured, and adds a new constructor,opentracing.NewTracerProvider
, that acceptstrace.TracerProvider
. It also marks the old static constructorNewWrappedTracerProvider
as deprecated.There is an example usage here: https://github.com/sourcegraph/sourcegraph/pull/40945 . See discussion on this PR for more details.