Opentelemetry-java: OpenTracing TracerShim doesn't handle case-insenstitive logic for keys on context extraction

Created on 24 Nov 2020  路  3Comments  路  Source: open-telemetry/opentelemetry-java

Trace context can be injected using case insensitive logic for keys.

Then extraction will not be able to extract context because extraction is case-sensitive:
https://github.com/open-telemetry/opentelemetry-java/blob/master/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java#L76

Proposed fix for TextMapGetter:

@Override
public String get(Map<String, String> carrier, String key) {
  for (Map.Entry<String, String> entry : carrier.entrySet()) {
    if (key.equalsIgnoreCase(entry.getKey())) {
      return entry.getValue();
    }
  }
  return null;
}
Bug p2 required-for-ga

All 3 comments

I'm not sure if this is a bug... In OpenTelemetry, it is the responsibility of the carrier to implement case-sensitive-ness. So the map's get implementation would be expected to be case-insensitive. Iterating the map seems quite inefficient.

I see. OK, looks like a bug indeed.

CC @carlosalberto

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pavolloffay picture pavolloffay  路  5Comments

carlosalberto picture carlosalberto  路  4Comments

poogurgaon picture poogurgaon  路  4Comments

jkwatson picture jkwatson  路  5Comments

jkwatson picture jkwatson  路  3Comments