use of io.opentelemetry.api.baggage.Baggage in project camel-quarkus by apache.
the class CamelQuarkusOpenTelemetryTracer method startExchangeBeginSpan.
@Override
protected SpanAdapter startExchangeBeginSpan(Exchange exchange, SpanDecorator sd, String operationName, SpanKind kind, SpanAdapter parent) {
// augment the existing incoming one with additional camel specific tags & attributes
if (sd instanceof PlatformHttpSpanDecorator || sd instanceof ServletSpanDecorator) {
Span span = Span.fromContext(Context.current());
Baggage baggage = Baggage.fromContext(Context.current());
return new OpenTelemetrySpanAdapter(span, baggage);
}
return super.startExchangeBeginSpan(exchange, sd, operationName, kind, parent);
}
use of io.opentelemetry.api.baggage.Baggage in project opentelemetry-java by open-telemetry.
the class W3CBaggagePropagatorTest method extract_key_trailingSpaces.
@Test
void extract_key_trailingSpaces() {
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
Context result = propagator.extract(Context.root(), ImmutableMap.of("baggage", "key =value1"), getter);
Baggage expectedBaggage = Baggage.builder().put("key", "value1").build();
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
}
use of io.opentelemetry.api.baggage.Baggage in project opentelemetry-java by open-telemetry.
the class W3CBaggagePropagatorTest method extract_member_single_withMetadata.
@Test
void extract_member_single_withMetadata() {
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
Context result = propagator.extract(Context.root(), ImmutableMap.of("baggage", "key=value;metadata-key=value;othermetadata"), getter);
Baggage expectedBaggage = Baggage.builder().put("key", "value", BaggageEntryMetadata.create("metadata-key=value;othermetadata")).build();
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
}
use of io.opentelemetry.api.baggage.Baggage in project opentelemetry-java by open-telemetry.
the class W3CBaggagePropagatorTest method inject_emptyBaggage.
@Test
void inject_emptyBaggage() {
Baggage baggage = Baggage.empty();
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
Map<String, String> carrier = new HashMap<>();
propagator.inject(Context.root().with(baggage), carrier, Map::put);
assertThat(carrier).isEmpty();
}
use of io.opentelemetry.api.baggage.Baggage in project opentelemetry-java by open-telemetry.
the class W3CBaggagePropagatorTest method extract_key_singleValid_multipleInvalid.
@Test
void extract_key_singleValid_multipleInvalid() {
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
Context result = propagator.extract(Context.root(), ImmutableMap.of("baggage", "ke<y=value1, ;sss,key=value;meta1=value1;meta2=value2,ke(y=value;meta=val "), getter);
Baggage expectedBaggage = Baggage.builder().put("key", "value", BaggageEntryMetadata.create("meta1=value1;meta2=value2")).build();
assertThat(Baggage.fromContext(result)).isEqualTo(expectedBaggage);
}
Aggregations