Skip to content
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

Updates to latest zipkin and switches to 128-bit trace IDs #10

Merged
merged 2 commits into from
Dec 20, 2016
Merged

Updates to latest zipkin and switches to 128-bit trace IDs #10

merged 2 commits into from
Dec 20, 2016

Conversation

codefromthecrypt
Copy link
Member

This changes to the latest version of Zipkin and adjusts the code to use
128-bit trace ids as defined by Zipkin. This fills high bits with zero
when the trace doesn't have high bits set. This would occur when 64-bit
trace IDs are in use.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

// zipkin conditionally encodes its id as 16 chars if the high bits are zero
// This unconditionally encodes as 32 chars as Stackdriver trace IDs are fixed length.
char[] result = new char[32];
Util.writeHexLong(result, 0, zipkinSpan.traceIdHigh);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ps if you don't like this, I can switch back to the other way, np

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with this if you're OK with this depending on zipkin.internal.Util.

We may want to have this write zipkinSpan.traceId for both the high and low bits if zipkinSpan.traceIdHigh isn't set. Some users call our API and order results by traceId to get a "random sample" of traces. Duplicating the 64-bit ID instead of padding the ID with zeros will remove some sampling bias for any projects that contain both Zipkin and Stackdriver traces. Do you think that would cause any problems?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only problem with duplicating or otherwise is that the id won't match what's put in the logging context. Interesting use case on the "random sample" this will clash on that, though curious why they don't shuffle instead? Is this tool OSS (ex can we open an issue to discuss that?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incidentally, we can always change this later.. I'll do this.. will revert to the original impl, but add a comment on why we are duplicating. Later it can be followed-up as necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's not an OSS tool. However, it is a pretty small use case, and I'm not sure if there are many projects that will have a mix of Stackdriver and Zipkin traces. The mismatch with the logging context may be a bigger issue if you think Zipkin users reference that frequently. We can pad with 0's if you think that would be better. Anyway, this problem won't exist once Zipkin trace ID's are 128-bit. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, if you do pad with 0's, TraceTranslatorTest:testTranslateTrace needs to be updated.

@@ -41,6 +41,10 @@
<tag>HEAD</tag>
</scm>

<properties>
<zipkin.version>1.18.0</zipkin.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also ps 1.18.0 is syncing to maven central, and not actually needed. probably good to use it (or 1.17.1) though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This changes to the latest version of Zipkin and adjusts the code to use
128-bit trace ids as defined by Zipkin. This fills high bits with zero
when the trace doesn't have high bits set. This would occur when 64-bit
trace IDs are in use.
@codefromthecrypt
Copy link
Member Author

codefromthecrypt commented Dec 20, 2016 via email

@googlebot
Copy link

CLAs look good, thanks!

@codefromthecrypt
Copy link
Member Author

codefromthecrypt commented Dec 20, 2016 via email

@codefromthecrypt
Copy link
Member Author

codefromthecrypt commented Dec 20, 2016 via email

Doing so helps remove confusion with 64-bit trace ids, which are encoded
by Zipkin with 16 characters (implicitly padded left with zeros).
@codefromthecrypt
Copy link
Member Author

codefromthecrypt commented Dec 20, 2016 via email

Copy link
Contributor

@kevinmdavis kevinmdavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Adrian!

@kevinmdavis kevinmdavis merged commit 7c61162 into openzipkin:master Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants