Repository navigation
Conversation
Co-authored-by: ws-yukon <ws-yukon@users.noreply.github.com>
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
OpenTracingOptions.DEFAULT_INSTANCEvia a private staticDefaultInstanceHolderclass returned fromOpenTracingOptions.getDefaultInstance().MoreObjects.firstNonNull(tracer, GlobalTracer.get())inOpenTracingOptions.Builder.build()withtracer != null ? tracer : GlobalTracer.get()soGlobalTracer.get()is only evaluated when no explicitTracerwas configured, and remove the unusedMoreObjectsimport.OpenTracingOptionsTestverifying with a child-firstURLClassLoaderthat buildingOpenTracingOptionswith an explicitTracerdoes not loadio.opentracing.util.GlobalTracer, whilegetDefaultInstance()andnewBuilder().build()without a tracer still lazily load it.Why?
Previously, configuring
temporal-opentracingwith an explicitTracer(for example, an OpenTelemetry-to-OpenTracing shim) still loaded and initializedio.opentracing.util.GlobalTracerin two places:OpenTracingOptions's static initializer eagerly builtDEFAULT_INSTANCE = OpenTracingOptions.newBuilder().build(), callingGlobalTracer.get()as soon asOpenTracingOptionswas initialized.Builder.build()calledMoreObjects.firstNonNull(tracer, GlobalTracer.get()), which eagerly evaluated its second argumentGlobalTracer.get()even whentracerwas non-null.With Java agents such as
dd-trace-javawhenDD_TRACE_OTEL_ENABLED=true, merely loadingio.opentracing.util.GlobalTraceractivates the agent's OpenTracing integration even when an explicit OTel-shimTraceris passed viasetTracer(...), causingBoth OpenTracing and OpenTelemetry integrations are enabledwarnings.Checklist
How was this tested:
OpenTracingOptionsTest(explicitTracerDoesNotLoadGlobalTracer,buildWithoutExplicitTracerLoadsGlobalTracer,getDefaultInstanceLoadsGlobalTracerLazily,getDefaultInstanceReturnsSingleton).GlobalTracerTestand the full:temporal-opentracingmodule checks pass via./gradlew :temporal-opentracing:check :temporal-opentracing:javadoc(28 tests passed,spotlessCheck, ErrorProne, and--release 8compilation clean).Any docs updates needed?