-
Notifications
You must be signed in to change notification settings - Fork 344
Add a 0.30 compatibility package/layer #221
Add a 0.30 compatibility package/layer #221
Conversation
* Move the old 0.30 API to the opentracing-v030 package. * Shim layer (TracerShim) * Bring AutoFinishScopeManager to opentracing.util to support reference count.
Haven't reviewed in detail, but thank you! |
It seems integrating the v030 packaging and the shim changes had lost the BaseTracerShim changes.
I cannot set tag on ActiveSpan now:
|
@malafeev Hey, thanks for the catch. Now it's fixed (the |
thanks @carlosalberto , verified |
does it mean that all imports (ActiveSpan, BaseSpan) have to be changed to this? |
@pavolloffay Yes - for people using this Shim + the old API, that is (as There were some ideas in how to help people with this. Maybe some Gradle/Maven plugin/script to refactor their 'old' code. Maybe this can be played with down the road? As a note, the idea is to let people using the 0.31 API to incrementally update their instrumentation code using 0.30, so this would be a small price to pay. |
I would be more strict: don't add compatibility package. |
I agree with @malafeev. I would rather not add all this additional complexity. My main concern then is does this require trace implementers to then implement both apis? |
Updating an import: 30 seconds. Changing programming model across a framework? Hours or days. The refcount tracking code should be entirely generic and not need any implementation by backend providers AIUI. |
If we have production issue then 30 seconds vs hours/days makes sense. |
So you'll place users in a choice of having to do a more complex thing, or be at risk of old dependencies which may have security flaws in it. As soon e.g. spring upgrades their bindings to 0.31, everyone with custom code written in spring also has to upgrade, also in lockstep: this is a transitive problem. Forcing a lock-step upgrade when none is strictly required brings no benefit to the project, but can make your users life more stressful. I really don't understand why you'd ever do that. Given that code is already written, please don't force other people to coordinate changes to your schedule. |
is there any example of using it? |
But you can update with super-little work with the shim, no? |
ok, if it works for you. for me it's a headache to make this super-little work. |
I didn't find any tests for Sope-ActiveSpan move (and vice versa). |
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.
Isn't it better to use maven plugin to move all classes into the new package?
|
||
@Override | ||
public SpanBuilderShim asChildOf(SpanContext parent) { | ||
checkArgumentNotNull(parent, "parent"); |
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.
this should not throw exception
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.
the same for other child/references methods
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.
Yeah, I was thinking about it earlier. I'd like to report bad arguments, but then again, these ones should stick to the standard. Will adjust them as expected.
Closing this in favor of the new |
From 0.30.0 to 0.31.0 they have made some changes, https://github.com/opentracing/opentracing-java/pull/251/files Highlights are : - opentracing/opentracing-java#219 - a new method in Tracer, activeSpan - SpanBuilder's startActive changed to startActive(boolean finishSpanOnClose) Last but not least, found that someone has created a compatibility layer for 0.30.0 API, more info: opentracing/opentracing-java#221 They finally decided to create it as an external library https://github.com/opentracing/opentracing-java-v030/, which is already on maven central https://mvnrepository.com/artifact/io.opentracing/opentracing-v030/0.0.4
This is an updated PR for the compatibility layer for the 0.30 API.
The changes are mostly:
Put all the 0.30 packages under a new
opentracing-v030
package (so not mess with the existing code). For keeping things uniform, the code from 0.30 has been mostly copied over.Have a
io.opentracing.v_030.shim.TracerShim
class to wrapio.opentracing.Tracer
instances and expose them under the 0.30 API. This required the addition ofAutoFinishScopeManager
, which is aScopeManager
supporting reference count. I decided to put it underutil
as it may be used in other components later on, and not only the Shim (like in Scala asynchronous frameworks).Any feedback is appreciated ;) Observe the idea is to let instrumentation authors to incrementally support the new API while keeping backwards compatibility against the old one.