use of io.opentracing.propagation.TextMapAdapter in project brave by openzipkin.
the class OpenTracingAdapterTest method extractTraceContext.
@Test
public void extractTraceContext() {
Map<String, String> map = new LinkedHashMap<>();
map.put("X-B3-TraceId", "0000000000000001");
map.put("X-B3-SpanId", "0000000000000002");
map.put("X-B3-Sampled", "1");
map.put("User-Id", "sammy");
BraveSpanContext openTracingContext = opentracing.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(map));
assertThat(openTracingContext.context).isEqualTo(TraceContext.newBuilder().traceId(1L).spanId(2L).sampled(true).build());
assertThat(openTracingContext.baggageItems()).containsExactly(entry(BAGGAGE_FIELD.name(), "sammy"));
}
Aggregations