Skip to content

Commit

Permalink
Fix opentracing header name issue
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolsamad committed Sep 20, 2023
1 parent 9b081e1 commit a66f8c3
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;

Expand Down Expand Up @@ -108,14 +109,16 @@ public <C> Context extract(Context context, @Nullable C carrier, TextMapGetter<C
if (carrier != null) {
BaggageBuilder baggageBuilder = Baggage.builder();
for (String key : getter.keys(carrier)) {
if (!key.startsWith(PREFIX_BAGGAGE_HEADER)) {
String lowercaseKey = key.toLowerCase(Locale.ROOT);
if (!lowercaseKey.startsWith(PREFIX_BAGGAGE_HEADER)) {
continue;
}
String value = getter.get(carrier, key);
if (value == null) {
continue;
}
baggageBuilder.put(key.replace(OtTracePropagator.PREFIX_BAGGAGE_HEADER, ""), value);
String baggageKey = lowercaseKey.replace(OtTracePropagator.PREFIX_BAGGAGE_HEADER, "");
baggageBuilder.put(baggageKey, value);
}
Baggage baggage = baggageBuilder.build();
if (!baggage.isEmpty()) {
Expand Down

0 comments on commit a66f8c3

Please sign in to comment.