Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Tolerate reads of 128 bit X-B3-TraceId #52

Merged
merged 1 commit into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions jaeger-zipkin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ apply plugin: 'com.github.kt3k.coveralls'
description = 'Integration library for Zipkin'

dependencies {
compile group: 'io.zipkin.reporter', name: 'zipkin-reporter', version: '0.4.2'
compile group: 'io.zipkin.reporter', name: 'zipkin-sender-urlconnection', version: '0.4.2'
compile group: 'io.zipkin.reporter', name: 'zipkin-reporter', version: '0.4.4'
compile group: 'io.zipkin.reporter', name: 'zipkin-sender-urlconnection', version: '0.4.4'
compile project(':jaeger-core')

testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group: 'org.mockito', name: 'mockito-all', version: mockitoVersion
testCompile group: 'io.zipkin.java', name: 'zipkin-junit', version: '1.8.3'
testCompile group: 'io.zipkin.brave', name: 'brave-http', version: '3.10.0'
testCompile group: 'io.zipkin.java', name: 'zipkin-junit', version: '1.11.1'
testCompile group: 'io.zipkin.brave', name: 'brave-http', version: '3.11.0'
}

jacocoTestReport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import zipkin.internal.Util;

import static com.uber.jaeger.propagation.b3.B3TextMapCodec.SPAN_ID_NAME;
import static com.uber.jaeger.propagation.b3.B3TextMapCodec.TRACE_ID_NAME;
import static org.junit.Assert.assertEquals;

public class B3TextMapCodecTest {
Expand All @@ -53,6 +56,21 @@ public void testExtract_rootSpan() throws Exception {
assertEquals(1, context.getFlags()); // sampled
}

@Test
public void downgrades128BitTraceIdToLower64Bits() throws Exception {
String hex128Bits = "463ac35c9f6413ad48485a3953bb6124";
String lower64Bits = "48485a3953bb6124";

DelegatingTextMap textMap = new DelegatingTextMap();
textMap.put(TRACE_ID_NAME, hex128Bits);
textMap.put(SPAN_ID_NAME, lower64Bits);

SpanContext context = b3Codec.extract(textMap);

assertEquals(Util.lowerHexToUnsignedLong(lower64Bits), context.getTraceID());
assertEquals(Util.lowerHexToUnsignedLong(lower64Bits), context.getSpanID());
}

@Test
public void testExtract_childSpan() throws Exception {
SpanId spanId = SpanId.builder().spanId(2L).traceId(1L).parentId(1L).build();
Expand Down