Ensure that headers are read case insensitive.
MODIFY
dd-trace/src/main/java/com/datadoghq/trace/propagation/HTTPCodec.java
dd-trace/src/main/java/com/datadoghq/trace/propagation/HTTPCodec.java
@@ -38,15 +38,16 @@ public class HTTPCodec implements Codec<TextMap> {
for (final Map.Entry<String, String> entry : carrier) {
- if (entry.getKey().equals(TRACE_ID_KEY)) {
+ final String key = entry.getKey().toLowerCase();
+ if (key.equalsIgnoreCase(TRACE_ID_KEY)) {
traceId = Long.parseLong(entry.getValue());
- } else if (entry.getKey().equals(SPAN_ID_KEY)) {
+ } else if (key.equalsIgnoreCase(SPAN_ID_KEY)) {
spanId = Long.parseLong(entry.getValue());
- } else if (entry.getKey().startsWith(OT_BAGGAGE_PREFIX)) {
+ } else if (key.startsWith(OT_BAGGAGE_PREFIX)) {
if (baggage.isEmpty()) {
baggage = new HashMap<>();
}
- baggage.put(entry.getKey().replace(OT_BAGGAGE_PREFIX, ""), decode(entry.getValue()));
+ baggage.put(key.replace(OT_BAGGAGE_PREFIX, ""), decode(entry.getValue()));
}
}
DDSpanContext context = null;

MODIFY
dd-trace/src/test/java/com/datadoghq/trace/propagation/HTTPCodecTest.java
dd-trace/src/test/java/com/datadoghq/trace/propagation/HTTPCodecTest.java
@@ -56,10 +56,10 @@ public class HTTPCodecTest {
final Map<String, String> actual =
new HashMap<String, String>() {
{
- put(TRACE_ID_KEY, "1");
- put(SPAN_ID_KEY, "2");
- put(OT_BAGGAGE_PREFIX + "k1", "v1");
- put(OT_BAGGAGE_PREFIX + "k2", "v2");
+ put(TRACE_ID_KEY.toUpperCase(), "1");
+ put(SPAN_ID_KEY.toUpperCase(), "2");
+ put(OT_BAGGAGE_PREFIX.toUpperCase() + "k1", "v1");
+ put(OT_BAGGAGE_PREFIX.toUpperCase() + "k2", "v2");
}
};

Ensure that headers are read case insensitive.