TextMapCodec implements Codec<TextMap> { @Override public void inject(JaegerSpanContext spanContext, TextMap carrier) { carrier.put(contextKey, contextAsString(spanContext)); for (Map.Entry<String, String> entry : spanContext.baggageItems()) { carrier.put(keys.prefixedKey(entry.getKey(), baggagePrefix), encodedValue(entry.getValue())); } } TextMapCodec(boolean urlEncoding); private  TextMapCodec(Builder builder); static String contextAsString(JaegerSpanContext context); @Override void inject(JaegerSpanContext spanContext, TextMap carrier); @Override JaegerSpanContext extract(TextMap carrier); @Override String toString(); static Builder builder();  }
@Test public void testInjectDoNotEncodeSpanContext() { TextMapCodec codec = new TextMapCodec(true); Map<String, String> headers = new HashMap<String, String>(); long traceIdLow = 42; long spanId = 1; long parentId = 0; codec.inject(new JaegerSpanContext(0L, traceIdLow, spanId, parentId, (byte)1), new TextMapAdapter(headers)); String traceId = headers.get("uber-trace-id"); assertEquals("000000000000002a:0000000000000001:0:1", traceId); }