-
Notifications
You must be signed in to change notification settings - Fork 95
No more ThreadLocals, delegate everything to 'palantir/tracing-java' #799
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
36e5dac
[WIP] delegate all tracing calls to `tracing-java`
qinfchen f321e2c
cleanup
qinfchen c78a24b
Use published versions of libraries
iamdanfox edfa0d6
Everything compiles
iamdanfox 6a8471a
Convert#span actually works now
iamdanfox 68d893a
Implement Convert#toRemotingTrace
iamdanfox 420c0e8
All converters propagate nulls
iamdanfox 6ec78ae
Tracer#subscribe returns a remoting span observer
iamdanfox d4dc7d6
Delete redundant fully-qualified names in TracersTest
iamdanfox 332bbe1
Move longToPaddedHex function out of Tracers
iamdanfox 9e6effd
Delete an asConjure method
iamdanfox 1beda24
@Ignore one TracerTest
iamdanfox 6a02d6f
Thanks checkstyle
iamdanfox f3724a3
Reduce visibility of Convert class
iamdanfox 9c45298
Fix one Convert method
iamdanfox 13fb17c
Remove mavenLocal()
iamdanfox 0a5b297
Move Utilities to test source set
iamdanfox 8a06a46
Better javadoc and warnings
iamdanfox bb252e2
Restore CloseableTracerTest
iamdanfox badb51c
Delete some unused fields and point to their new locations
iamdanfox b20a71e
rearrange method orders and remove broken javadoc links
qinfchen 1bd0d56
remove Tracers.TRACE_ID_KEY and use java-tracing TRACE_ID_KEY
qinfchen 0ac9f54
thanks checkstyle
qinfchen e9c0d1e
Revert "remove Tracers.TRACE_ID_KEY and use java-tracing TRACE_ID_KEY"
iamdanfox adf0f74
Don't make Trace public
iamdanfox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move longToPaddedHex function out of Tracers
- Loading branch information
commit 332bbe156cbfc9854ed2a10e6a4df51fe4a74b43
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tracing/src/main/java/com/palantir/remoting3/tracing/Utilities.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /* | ||
| * (c) Copyright 2018 Palantir Technologies Inc. All rights reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.palantir.remoting3.tracing; | ||
|
|
||
| public final class Utilities { | ||
| private static final char[] HEX_DIGITS = | ||
| {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; | ||
|
|
||
| private Utilities() {} | ||
|
|
||
| /** | ||
| * Convert a long to a big-endian hex string. Hand-coded implementation is more efficient than | ||
| * Strings.pad(Long.toHexString) because that code has to deal with mixed length longs, and then mixed length | ||
| * amounts of padding - we want to minimise the overhead of tracing. | ||
| */ | ||
| static String longToPaddedHex(long number) { | ||
| char[] data = new char[16]; | ||
| data[0] = HEX_DIGITS[(int) ((number >> 60) & 0xF)]; | ||
| data[1] = HEX_DIGITS[(int) ((number >> 56) & 0xF)]; | ||
| data[2] = HEX_DIGITS[(int) ((number >> 52) & 0xF)]; | ||
| data[3] = HEX_DIGITS[(int) ((number >> 48) & 0xF)]; | ||
| data[4] = HEX_DIGITS[(int) ((number >> 44) & 0xF)]; | ||
| data[5] = HEX_DIGITS[(int) ((number >> 40) & 0xF)]; | ||
| data[6] = HEX_DIGITS[(int) ((number >> 36) & 0xF)]; | ||
| data[7] = HEX_DIGITS[(int) ((number >> 32) & 0xF)]; | ||
| data[8] = HEX_DIGITS[(int) ((number >> 28) & 0xF)]; | ||
| data[9] = HEX_DIGITS[(int) ((number >> 24) & 0xF)]; | ||
| data[10] = HEX_DIGITS[(int) ((number >> 20) & 0xF)]; | ||
| data[11] = HEX_DIGITS[(int) ((number >> 16) & 0xF)]; | ||
| data[12] = HEX_DIGITS[(int) ((number >> 12) & 0xF)]; | ||
| data[13] = HEX_DIGITS[(int) ((number >> 8) & 0xF)]; | ||
| data[14] = HEX_DIGITS[(int) ((number >> 4) & 0xF)]; | ||
| data[15] = HEX_DIGITS[(int) ((number >> 0) & 0xF)]; | ||
| return new String(data); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
I don't think we should delete public static final fields like this, because if some consumer is depending on
com.palantir.remoting3.tracingTracers.TRACE_ID_KEYthen they'd suddenly break?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 doesn't seem like anyone is using it, https://github.com/search?p=2&q=Tracers.TRACE_ID_KEY&type=Code
i also did a quick search on the key internally and no internal consumer is using it.
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 still don't think we should remove things like this when there isn't a clear motivation - what if there was a user that didn't appear in your search? Did you check OSS consumers too (e.g. atlasdb?)