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

Add constructors/methods to the base tracers to enable injecting an OpenTelemetry instance #2197

Merged
merged 4 commits into from
Feb 5, 2021

Conversation

jkwatson
Copy link
Contributor

@jkwatson jkwatson commented Feb 4, 2021

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.

@@ -111,7 +110,7 @@ public HttpHost getTarget() {
@Override
public HttpRequest generateRequest() throws IOException, HttpException {
HttpRequest request = delegate.generateRequest();
GlobalOpenTelemetry.getPropagators()
tracer().getPropagators()
Copy link
Contributor Author

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.

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

* 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.
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@anuraaga anuraaga left a 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

@iNikem iNikem merged commit 644ee18 into open-telemetry:main Feb 5, 2021
@trask trask mentioned this pull request Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants