0

I am adding Baggage to an existing trace as shown below. What I find is that the baggage is not getting propagated. 'traceId','spanId' do get propagated though. What could be wrong with the setup below ?

Quarkus version 2.16.5Final

Service A :

try (var scope =
        Context.current()
            .with(
                Baggage.builder()
                    .put("RequestId", String.valueOf(message.getRequestId()))
                    .build())
            .makeCurrent()) {
            //......some logic here
            emitter.send(KafkaRecord.of(key, message));
           }

Service B where I receive the Kafka Message:

@ApplicationScoped
public class MDCEnricher implements OutgoingInterceptor {
  @Override
  public Message<?> onMessage(Message<?> message) {
    Baggage.current()
        .forEach(
            (s, baggageEntry) -> {
              MDC.put(s, baggageEntry.getValue());
            });

    return message;
  }

}

Service B is also calling Service C using REST.

Service C

@Slf4j
public class MDCFilter {
  @ServerRequestFilter
  public Uni<RestResponse<Void>> copyBaggageIntoMDC(UriInfo uriInfo, HttpHeaders httpHeaders, ContainerRequestContext requestContext){
    SpanContext spanContext = Span.current().getSpanContext();
    Baggage.current()
        .forEach(
            (s, baggageEntry) -> {
              MDC.put(s, baggageEntry.getValue());
            });
    return Uni.createFrom().item((RestResponse<Void>) null);
  }
}

quarkus log format in all service :

quarkus.log.console.format=%d{HH:mm:ss} %-5p [%X] [%c{2.}] (%t) %s%e%n

I expect to see 'RequestId' which I added as baggage in Service A to be logged in all applications but that isn't working. The only MDC values I see are 'traceId' and 'spanId'

Kiran K
  • 703
  • 4
  • 11

0 Answers0