-
Notifications
You must be signed in to change notification settings - Fork 775
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
Add constructors/methods to the base tracers to enable injecting an OpenTelemetry instance #2197
Add constructors/methods to the base tracers to enable injecting an OpenTelemetry instance #2197
Conversation
@@ -111,7 +110,7 @@ public HttpHost getTarget() { | |||
@Override | |||
public HttpRequest generateRequest() throws IOException, HttpException { | |||
HttpRequest request = delegate.generateRequest(); | |||
GlobalOpenTelemetry.getPropagators() | |||
tracer().getPropagators() |
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.
I updated this particular instrumentation because I wanted to make sure that the basic idea was workable.
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!
...entation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/HttpClientTracer.java
Show resolved
Hide resolved
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java
Show resolved
Hide resolved
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java
Outdated
Show resolved
Hide resolved
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/tracer/BaseTracer.java
Show resolved
Hide resolved
* Prefer to pass in an OpenTelemetry instance, rather than just a Tracer, so you don't have to | ||
* use the GlobalOpenTelemetry Propagator instance. | ||
* | ||
* @deprecated prefer to pass in an OpenTelemetry instance, instead. |
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.
These artifacts aren't used much so not a big deal IMO, but as general practice, we'd link to the new method, @deprecated Use {@link #BaseTracer(OpenTelemetry)} instead
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.
that's a good idea. Happy to amend this PR, or follow-up later.
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.
Nah wouldn't worry too much about the doc here
I haven't gone and updated any of the many other sub-tracers to inject the global, but having the capability means we can start migrating toward that model. This will enable the spring sleuth integration to not have to mess around with the global instance during startup.