Update to Brave 5#29
Update to Brave 5#29devinsba wants to merge 1 commit intoSmartThingsOSS:masterfrom devinsba:update-brave
Conversation
codefromthecrypt
left a comment
There was a problem hiding this comment.
made some comments, not all of which need to be addressed immediately
| 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.
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
| 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) { |
| 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.
is it zero is not valid? or an unnecessarily long string of zeros :)
There was a problem hiding this comment.
The brave HexCodec class throws a NumberFormatException if you try to encode hex that ends up equaling 0
| 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 |
| @Ignore | ||
| @Test | ||
| public void injectingFlagsShouldNotUnsetBuilderValues() { | ||
| SimpleB3ContextCarrier carrier = SimpleB3ContextCarrier.newBuilder() |
There was a problem hiding this comment.
wonder if this type needs to still exist? (ok if it does for now, just curious)
| </dependency> | ||
| <dependency> | ||
| <groupId>io.zipkin.java</groupId> | ||
| <groupId>io.zipkin.zipkin2</groupId> |
There was a problem hiding this comment.
I don't think you'll need this dep except maybe in testing as we don't access endpoint directly anymore
| TracedConsumerRecord<K, byte[]> tracedConsumerRecord = getTracedConsumerRecord(record); | ||
| TraceContextOrSamplingFlags traceContextOrSamplingFlags = | ||
| tracedConsumerRecord.traceContextOrSamplingFlags; | ||
| TraceContext ctx = traceContextOrSamplingFlags.context(); |
There was a problem hiding this comment.
though this file itself possible is delete worthy, an aside to consider what needs to happen now vs later
| builder.parentId(envelope.getParentId().getValue()); | ||
| } | ||
| TraceContextOrSamplingFlags traceContextOrSamplingFlags = TraceContextOrSamplingFlags.create(builder); | ||
| TraceContextOrSamplingFlags traceContextOrSamplingFlags = TraceContextOrSamplingFlags.create(builder.build()); |
There was a problem hiding this comment.
make a single-message version of this eventually, if consumer interceptor are still needed.
| <groupId>io.zipkin.java</groupId> | ||
| <groupId>io.zipkin.zipkin2</groupId> | ||
| <artifactId>zipkin</artifactId> | ||
| <optional>true</optional> |
There was a problem hiding this comment.
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.
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
@Ignoreon 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