-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update to Brave 5 #29
base: master
Are you sure you want to change the base?
Conversation
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.
made some comments, not all of which need to be addressed immediately
@@ -222,7 +222,7 @@ | |||
|
|||
private static final class HttpAdapter extends HttpClientAdapter<Request, HttpResponseStatus> { | |||
|
|||
@Override public boolean parseServerAddress(Request req, Endpoint.Builder builder) { | |||
@Override public boolean parseServerIpAndPort(Request req, Endpoint.Builder builder) { |
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.
you can remove this method entirely I think. then separately parse the IP/port like this https://github.com/openzipkin/brave/blob/master/instrumentation/httpasyncclient/src/main/java/brave/httpasyncclient/TracingHttpAsyncClientBuilder.java#L86
@@ -154,7 +154,7 @@ private ClientTracing() {} | |||
|
|||
private static final class HttpAdapter extends HttpClientAdapter<Request, HttpResponseStatus> { | |||
|
|||
@Override public boolean parseServerAddress(Request req, Endpoint.Builder builder) { | |||
@Override public boolean parseServerIpAndPort(Request req, Endpoint.Builder builder) { |
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.
same comment
@@ -135,7 +137,7 @@ public void injectingFlagsShouldNotUnsetBuilderValues() { | |||
SimpleB3ContextCarrier.Setter setter = new SimpleB3ContextCarrier.Setter(); | |||
setter.put(carrier, SimpleB3ContextCarrier.TRACE_ID_NAME, HexCodec.toLowerHex(1234)); | |||
setter.put(carrier, SimpleB3ContextCarrier.SPAN_ID_NAME, HexCodec.toLowerHex(9012)); | |||
setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000"); | |||
setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000"); // TODO 0 is not a valid hex anymore |
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.
is it zero is not valid? or an unnecessarily long string of zeros :)
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 brave HexCodec
class throws a NumberFormatException
if you try to encode hex that ends up equaling 0
@@ -156,7 +159,7 @@ public void injectingZeroFlagsShouldNotSetValues() { | |||
SimpleB3ContextCarrier.Setter setter = new SimpleB3ContextCarrier.Setter(); | |||
setter.put(carrier, SimpleB3ContextCarrier.TRACE_ID_NAME, HexCodec.toLowerHex(1234)); | |||
setter.put(carrier, SimpleB3ContextCarrier.SPAN_ID_NAME, HexCodec.toLowerHex(9012)); | |||
setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000"); | |||
setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000"); // TODO 0 is not a valid hex anymore |
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.
ditto
@@ -124,6 +125,7 @@ public void builderShouldCopyFrom() { | |||
assertThat(carrier2).isEqualTo(carrier); | |||
} | |||
|
|||
@Ignore | |||
@Test | |||
public void injectingFlagsShouldNotUnsetBuilderValues() { | |||
SimpleB3ContextCarrier carrier = SimpleB3ContextCarrier.newBuilder() |
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.
wonder if this type needs to still exist? (ok if it does for now, just curious)
@@ -57,7 +57,7 @@ | |||
<artifactId>brave</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>io.zipkin.java</groupId> | |||
<groupId>io.zipkin.zipkin2</groupId> |
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 you'll need this dep except maybe in testing as we don't access endpoint directly anymore
@@ -74,11 +87,8 @@ | |||
TracedConsumerRecord<K, byte[]> tracedConsumerRecord = getTracedConsumerRecord(record); | |||
TraceContextOrSamplingFlags traceContextOrSamplingFlags = | |||
tracedConsumerRecord.traceContextOrSamplingFlags; | |||
TraceContext ctx = traceContextOrSamplingFlags.context(); |
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.
though this file itself possible is delete worthy, an aside to consider what needs to happen now vs later
@@ -44,7 +57,7 @@ | |||
if (envelope.hasParentId()) { | |||
builder.parentId(envelope.getParentId().getValue()); | |||
} | |||
TraceContextOrSamplingFlags traceContextOrSamplingFlags = TraceContextOrSamplingFlags.create(builder); | |||
TraceContextOrSamplingFlags traceContextOrSamplingFlags = TraceContextOrSamplingFlags.create(builder.build()); |
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.
make a single-message version of this eventually, if consumer interceptor are still needed.
@@ -46,7 +46,7 @@ | |||
<artifactId>brave</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>io.zipkin.java</groupId> | |||
<groupId>io.zipkin.zipkin2</groupId> | |||
<artifactId>zipkin</artifactId> | |||
<optional>true</optional> |
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.
same comment on scope.. try to remove these or set as test dep
Span oneWay = withEndpoint((ctx != null) | ||
? tracing.tracer().joinSpan(ctx) | ||
: tracing.tracer().newTrace(traceContextOrSamplingFlags.samplingFlags())); | ||
Span oneWay; |
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.
one way isn't the better choice anymore. this pre-dated messaging model. not sure what's required to fix now vs later
I'm not sure I have the time to take this over the finish line right now. I ended up using an approach based around |
I see anyways flags zero is invalid. we only actually encode when
context.debug is true. iotw this test isnt testing something we would emit.
…On Fri, Mar 1, 2019, 12:09 AM Brian Devins-Suresh ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
brave-http-common/src/test/java/smartthings/brave/propagation/SimpleB3ContextCarrierEncodingTest.java
<#29 (comment)>
:
> @@ -135,7 +137,7 @@ public void injectingFlagsShouldNotUnsetBuilderValues() {
SimpleB3ContextCarrier.Setter setter = new SimpleB3ContextCarrier.Setter();
setter.put(carrier, SimpleB3ContextCarrier.TRACE_ID_NAME, HexCodec.toLowerHex(1234));
setter.put(carrier, SimpleB3ContextCarrier.SPAN_ID_NAME, HexCodec.toLowerHex(9012));
- setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000");
+ setter.put(carrier, SimpleB3ContextCarrier.FLAGS_NAME, "0000000000000000"); // TODO 0 is not a valid hex anymore
The brave HexCodec class throws a NumberFormatException if you try to
encode hex that ends up equaling 0
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD61__Hn2YNICYAt7GS3HztJcqUp74Aks5vR_9XgaJpZM4bQQ6X>
.
|
Really appreciate the attempt to upgrade things. I will take a look through this ASAP and see where I can help out. |
Would love to use this library once its all updated. |
Any update on this? |
@YasinK-IW do you have time to pick this up and address the comments? |
I've started the process toward Brave 5, I need to fix a couple more things in the tests. I may need some guidance from @adriancole on the HTTP ones, I'm not entirely sure how to convert those to be more idiomatic so that they pass the tests. I put notes and
@Ignore
on all the tests that didn't pass so that I could work through all the modules. I don't intend for this to be merged before all the@Ignore
's are removed