Search code examples
javaspring-bootspring-cloud-sleuth

how to force sleuth not send in single b3 header


I'm using sleuth in my Spring Boot application for log tracing, and my application also send some messages via Active MQ, but when i see the message properties, it send the trace with a single b3 header. how can i configure sleuth to separate the headers?


Solution

  • The default is not only better performance, but doesn't violate JMS header name rules. I would advise you figure out why you cannot use b3 single.

    If you must use multiple headers, you can do something like this:

    @Bean Propagation.Factory customPropagationFactory() {
      return B3Propagation.newFactoryBuilder()
          .injectFormat(Span.Kind.PRODUCER, Format.MULTI)
          .injectFormat(Span.Kind.CONSUMER, Format.MULTI)
          .build();
    }