dargui
dargui

Reputation: 133

Tracing in RabbitListener - observationEnabled

migrating from SpringBoot 2 to SpringBoot 3.1 in an application that uses @RabbitListener the tracing information relating to TraceId and SpanId no longer appears in the logs.
I used the new classes also forcing the generation

   Tracer tracer = Tracer.NOOP;
    Span span = tracer.currentSpan();
   span = tracer.nextSpan();

but it didn't help.

About the documentation:

Using Micrometer for observation is now supported, since version 3.0.5, for the RabbitStreamTemplate and the stream listener container. The container now also supports Micrometer timers (when observation is not enabled).

Set observationEnabled on each component to enable observation; this will disable Micrometer Timers because the timers will now be managed with each observation. When using annotated listeners, set observationEnabled on the container factory.

Has anyone had a similar problem?

Upvotes: 1

Views: 748

Answers (2)

min
min

Reputation: 1098

For anyone want rabbitTemplate have tracing feature too.
You need another config.
Also, you can just use properties instead java config:

spring.rabbitmq.template.observation-enabled=true
spring.rabbitmq.listener.simple.observation-enabled=true

Test with spring boot 3.3.3 work well for both rabbitTemplate and @RabbitListener

Upvotes: 0

user19465428
user19465428

Reputation: 66

(I only speak Chinese, the following is the translation) I am upgrading from 2.7 to 3.1, and now I have added a bean, you can try it

@Bean
ContainerCustomizer<SimpleMessageListenerContainer> containerCustomizer() {
    return container -> container.setObservationEnabled(true);
}

Upvotes: 5

Related Questions