-
Notifications
You must be signed in to change notification settings - Fork 849
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
OpenTracing Shim: Update Tracer.close() #5151
OpenTracing Shim: Update Tracer.close() #5151
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #5151 +/- ##
============================================
- Coverage 91.14% 90.91% -0.23%
+ Complexity 4911 4884 -27
============================================
Files 547 550 +3
Lines 14544 14476 -68
Branches 1399 1370 -29
============================================
- Hits 13256 13161 -95
- Misses 891 917 +26
- Partials 397 398 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@carlosalberto the spec seems to contradict itself: First it says:
Then later it says:
But the API doesn't define a
Not sure this would solve the problem because the usage pattern would just shift to |
So basically we don't want to tie ourselves to using a specific SDK - hence more the duck type alike approach of trying to go with the
Good call, yes. I think we should recommend, for Java specifically, that the users pass the fresh, newly created Let me know what you think and I will update the PR accordingly. (I will probably push that cc @yurishkuro |
@jkwatson maybe you have some opinion on the matter? No problem if you don't 😄 |
No strong opinion, aside from the fact that I don't think we want the shim to depend on the SDK. I wouldn't object strongly to the TracerProvider interface extending Closeable if that makes things easier for interop. We'd need to define clearly what it would mean for an alternative implementation to implement the |
I don't like the idea of adding I'm in favor of the duck typing approach where we check if the |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
I've pushed a commit to unobfuscate first if its I'm happy to merge this if folks are happy. |
} | ||
} | ||
|
||
private static TracerProvider maybeUnobfuscate(TracerProvider tracerProvider) { |
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'm confused by this method.
- in what sense is a provider "obfuscated"?
- if the class name equals to ObfuscatedTracerProvider, why not just cast to it and ask for the delegate?
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.
Check out the source for OpenTelemetrySdk.
OpenTelemetrySdk
implements OpenTelemetry
. The idea is that we don't want folks doing stuff like this:
OpenTelemetry openTelemetry = ...
SdkTracerProvider sdkTracerProvider = (SdkTracerProvider) openTelemetry.getTracerProvider();
sdkTracerProvider.shutdown();
If working in instrumentation code and all you have access to is OpenTelemetry
(i.e. not OpenTelemetrySdk
), you shouldn't be able to cast and call SDK specific methods.
The obfuscation layer adds friction to discourage this pattern. Though, as we see in this PR, its still possible via reflection.
opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java
Outdated
Show resolved
Hide resolved
@jkwatson / @carlosalberto any reason not to merge this for the upcoming release? |
Fixes #5081
As per the 1.17 Specification, the OpenTracing Tracer Close operation was added.
I feel tempted to deprecate the
OpenTracingShim.createTracerShim(OpenTelemetry)
method overload, as it wraps the actuallyTracerProvider
withObfuscatedTracerProvider
, which prevents checking whether the actual instance implementsCloseable
or not.