-
Notifications
You must be signed in to change notification settings - Fork 231
Upgrades internals to Zipkin v2 library #456
Upgrades internals to Zipkin v2 library #456
Conversation
Codecov Report
@@ Coverage Diff @@
## master #456 +/- ##
============================================
+ Coverage 88.29% 88.31% +0.01%
- Complexity 489 494 +5
============================================
Files 63 63
Lines 1846 1848 +2
Branches 240 241 +1
============================================
+ Hits 1630 1632 +2
Misses 139 139
Partials 77 77
Continue to review full report at Codecov.
|
ps I plan to add a test for the v2 path, but only after figuring out the following:
|
+1 on (1) If people are running Zipkin collectors with v1 thrift model only (i.e. have not upgraded to collectors that accept v2 model), would the now-deprecated v1 factory still work for them? |
The main change here is the library that sends the messages. both the new
and old factory method assume thrift. I think there is different code in
the same package which can use non-thrift. That hasnt changed as that side
is already using the zipkin2 reporter library.
on zipkin server side, v1 POST with thrift is available for the foreseeable
future and the kafka transport also still accepts thrift.
|
ok tests now use both paths. I'm keen either way, retaining the deprecated factory method for a release, or cutting it now. If we do the former, we need to remember to remove it later. |
As there is |
my goal is to drop the dependency on io.zipkin.java
dropping the thrift sender achieves that as long as dropping it doesn't
limit folks in some way I'm not aware of.
|
note even if you do drop the sender (now or later) the dependencies in
this change are cleaner, especially the tests. Please retain that part
if you decide to drop the sender.
|
* sender = ZipkinSender.create(KafkaSender.create("192.168.99.100:9092")); | ||
* sender = ZipkinSender.create( | ||
* KafkaSender.newBuilder() | ||
* .encoding(Encoding.THRIFT) |
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.
What happens if the encoding != thrift?
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.
Cool there is a check. nevermind
@yurishkuro etc I think the least tech debt way here is to remove the deprecated factory method which then removes a large part of this code which will restore coverage to where it was. This also allows a smooth transition for those who can't immediately switch off thrift (for example) if you say go, I'll do that and hopefully we can get this merged. |
@adriancole I have no problem with removing the factory, my question was about functional impact. I haven't followed zipkin v2 too closely, was it a change to JSON schema only, or did thrift model changed as well? If the thrift model is the same (https://github.com/openzipkin/zipkin-api/blob/master/thrift/zipkinCore.thrift - this one?), then upgrading the library to send it makes total sense. |
thrift is the same. we backported the encoding logic, so basically it takes
a v2 model and allocates it across a v1 (aka only) thrift struct when
writing.
will yank the old path which will be nicer I think in general.
|
ok ready to roll. I can squash or you can |
@@ -122,14 +119,13 @@ private static void buildTags(Span span, zipkin2.Span.Builder builder) { | |||
} | |||
} | |||
|
|||
private static InetAddress convertIp(int ip) { |
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 fixed this as it was bothering me
@@ -88,9 +89,6 @@ public void testAppendSpanTooLarge() throws Exception { | |||
|
|||
@Test | |||
public void testAppend() throws Exception { | |||
// find size of the initial span | |||
AutoExpandingBufferWriteTransport memoryTransport = |
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.
unused
@@ -160,9 +175,14 @@ public int close() throws SenderException { | |||
return n; | |||
} | |||
|
|||
@Override | |||
public String toString() { | |||
return "ZipkinSender{" + 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.
previous toString looked bad as another field was forgotten to be excluded. this is a problem with auto-generated toStrings. This type is simple and this won't break even if you add new fields later.
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.
Looks like this PR removes @ToString
and implements its own toString()
. Did you have problems with the resulting toString()
from @ToString
?
sorry i answered wrong question. this change is about senders. no impact as
they take byte arrays and dont mess with them besides bundling
…On Thu, 21 Jun 2018, 07:56 Adrian Cole, ***@***.***> wrote:
thrift is the same. we backported the encoding logic, so basically it
takes a v2 model and allocates it across a v1 (aka only) thrift struct when
writing.
will yank the old path which will be nicer I think in general.
|
Our (CNCF's) contributing policy requires signed commits (the DCO check), so it's best if you squash them and sign as a single commit (git commit -s ...) |
Signed with a Flourish
|
actually will push a slight test update as I used the wrong exception type on invalid format |
hopefully I've now addressed the severely annoying test coverage requirements |
jaeger-zipkin/build.gradle
Outdated
|
||
compile group: 'io.zipkin.java', name: 'zipkin', version: '2.8.1' | ||
compile group: 'io.zipkin.reporter2', name: 'zipkin-reporter', version: '2.6.0' | ||
implementation 'io.zipkin.reporter2:zipkin-reporter' |
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.
shouldn't this be api
scope?
jaeger-zipkin/build.gradle
Outdated
compile group: 'io.zipkin.java', name: 'zipkin', version: '2.8.1' | ||
compile group: 'io.zipkin.reporter2', name: 'zipkin-reporter', version: '2.6.0' | ||
implementation 'io.zipkin.reporter2:zipkin-reporter' | ||
implementation 'io.zipkin.reporter2:zipkin-sender-urlconnection' |
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 is new to me, it's related to https://github.com/jaegertracing/jaeger-client-java/pull/456/files#diff-88b7c47e47b8ee65263b6784b86fa0a7R1
I got this when I included it into a different project
[WARNING] The POM for io.jaegertracing:jaeger-zipkin:jar:0.29.1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
https://docs.gradle.org/4.6/userguide/java_library_plugin.html#sec:java_library_separation
Dependencies appearing in the api configurations will be transitively exposed to consumers of the library, and as such will appear on the compile classpath of consumers. Dependencies found in the implementation configuration will, on the other hand, not be exposed to consumers, and therefore not leak into the consumers' compile classpath. This comes with several benefits:
We basically require our clients to explicitly add dependency on zipkin-sender-urlconnection
to make this work. If am correct it will fail on java.lang.NoClassDefFoundError: zipkin2/reporter/urlconnection/URLConnectionSender
even if you use different sender.
hmm maybe they should both be api I guess. Will fix!
|
+1, or just include the reporter and let users specify sender they want. But it's a bigger breaking change. I guess url sender does not pull in anything special so it's fine to include it. |
hmm
|
looks like api can work if I upgrade to gradle 4.8, adding that.. |
@@ -1,5 +1,5 @@ | |||
distributionBase=GRADLE_USER_HOME | |||
distributionPath=wrapper/dists | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip |
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.
It would be awesome if you could update the version specified under the Wrapper task as well: https://github.com/jaegertracing/jaeger-client-java/blob/master/build.gradle#L40
@@ -160,9 +175,14 @@ public int close() throws SenderException { | |||
return n; | |||
} | |||
|
|||
@Override | |||
public String toString() { | |||
return "ZipkinSender{" + 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.
Looks like this PR removes @ToString
and implements its own toString()
. Did you have problems with the resulting toString()
from @ToString
?
@@ -52,7 +53,7 @@ | |||
Tracer tracer; | |||
|
|||
@Before | |||
public void setUp() throws 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.
+1
with regards to lombok toString. it was maintenance causing as someone
earlier forgot to exclude a field. I mentioned this in am earlier comment
on this PR
|
Sorry, missed your previous comment about the |
as thinga dont seem to be working like I hoped and I am spending more time than I should.. i will revert the bom thing amd repush the change. feel free to re-bom later. |
I will also revert the lombok tostring thing as that tool deserves no more time from me! |
Recent version of io.zipkin.zipkin2:zipkin has been backported to support thrift encoding. This updates the corresponding sender here to use that, notably to migrate off the io.zipkin.reporter libraries which receive no updates. Signed-off-by: Adrian Cole <acole@pivotal.io>
unless there's more karmatic debt to pay in the form of build failures, I'm done I think. |
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.
lgtm
@pavolloffay @jpkrohling how does it look to you?
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.
LGTM
@@ -48,41 +54,52 @@ | |||
* <p> | |||
* See https://github.com/openzipkin/zipkin/tree/master/zipkin-server | |||
*/ | |||
@ToString(exclude = "spanBuffer") | |||
@ToString(exclude = {"spanBuffer", "encoder"}) |
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.
\o/
(not that I'm a fan of Lombok, btw)
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.
thanks @adriancole
thanks for getting this merged
|
Which problem is this PR solving?
The current zipkin integration encourages use of a dead version of a library (io.zipkin.reporter)
Short description of the changes
Recent version of io.zipkin.zipkin2:zipkin has been backported to
support thrift encoding. This updates the corresponding sender here to
use that, notably to migrate off the io.zipkin.reporter libraries which
receive no updates.