Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Add a 0.30 compatibility package/layer #221

Closed

Conversation

carlosalberto
Copy link
Collaborator

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 wrap io.opentracing.Tracer instances and expose them under the 0.30 API. This required the addition of AutoFinishScopeManager, which is a ScopeManager supporting reference count. I decided to put it under util 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.

* Move the old 0.30 API to the opentracing-v030 package.
* Shim layer (TracerShim)
* Bring AutoFinishScopeManager to opentracing.util to support reference count.
@rbtcollins
Copy link

Haven't reviewed in detail, but thank you!

It seems integrating the v030 packaging and the
shim changes had lost the BaseTracerShim changes.
@coveralls
Copy link

Coverage Status

Coverage decreased (-6.3%) to 72.27% when pulling eb4ae34 on carlosalberto:v_030_compat_layer into b9feb48 on opentracing:v0.31.0.

@malafeev
Copy link

I cannot set tag on ActiveSpan now:

import io.opentracing.v_030.ActiveSpan;
import io.opentracing.v_030.tag.Tags;

ActiveSpan activeSpan = ...;
Tags.COMPONENT.set(activeSpan, "component");

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.0%) to 74.601% when pulling c1a568e on carlosalberto:v_030_compat_layer into b9feb48 on opentracing:v0.31.0.

@carlosalberto
Copy link
Collaborator Author

@malafeev Hey, thanks for the catch. Now it's fixed (the tags subpackage was referencing Span instead of BaseSpan).

@malafeev
Copy link

thanks @carlosalberto , verified

@pavolloffay
Copy link
Member

Have a io.opentracing.v_030.shim.TracerShim

does it mean that all imports (ActiveSpan, BaseSpan) have to be changed to this?

@carlosalberto
Copy link
Collaborator Author

@pavolloffay Yes - for people using this Shim + the old API, that is (as io.opentracing. will contain the new API).

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.

@malafeev
Copy link

I would be more strict: don't add compatibility package.
Who wants to migrate - will do.
Using this compatibility also takes time. Better migrate to new api.

@tylerbenson
Copy link

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?

@rbtcollins
Copy link

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.

@malafeev
Copy link

If we have production issue then 30 seconds vs hours/days makes sense.
But in case of not stable yet api supporting previous api just to free couple of hours/(days) looks not right.
I prefer force people to upgrade until we have 1.0 and start thinking how to make breaking changes.

@rbtcollins
Copy link

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.

@malafeev
Copy link

is there any example of using it?
I'm not sure that it will work as you described for spring app.
You cannot mix instrumented libs with v030 and v031, it will not work even with this package.

@rbtcollins
Copy link

But you can update with super-little work with the shim, no?

@malafeev
Copy link

ok, if it works for you. for me it's a headache to make this super-little work.

@pavolloffay
Copy link
Member

I didn't find any tests for Sope-ActiveSpan move (and vice versa).

Copy link
Member

@pavolloffay pavolloffay left a 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");
Copy link
Member

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

Copy link
Member

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

Copy link
Collaborator Author

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.

@carlosalberto
Copy link
Collaborator Author

Closing this in favor of the new opentracing-java-v030 repository effort.

yacota added a commit to yacota/stagemonitor that referenced this pull request Feb 11, 2018
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants