Attached my spring boot 3 application with rabbitMQ and micrometer tracing, its a spring web application.
Dummy.zip
Here traceID / spanID is not propagating to other threads for the events listeners. For the first event I am getting traceID/spanID but for subsequent event no tracing info. On analysis found that using different virtual-host in the binders for the queues blocks the tracing observation.
Log for event with Binder and specific virtual-cost (guest)
{"timestamp":"2024-02-27 13:34:26.638","level":"INFO","thread":"test-event-5","mdc":{"traceId":"65dd978a1c793d43931890ba4748e045","spanId":"931890ba4748e045"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
{"timestamp":"2024-02-27 13:34:33.075","level":"INFO","thread":"test-event-3","logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
Log for event with Binder and common virtual-cost (application)
{"timestamp":"2024-02-27 13:26:44.835","level":"INFO","thread":"test-event-4","mdc":{"traceId":"65dd95bc7e86db9acb0ce5ac20ed8800","spanId":"e00226a44cb852f2"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
{"timestamp":"2024-02-27 13:26:53.533","level":"INFO","thread":"test-event-10","mdc":{"traceId":"65dd95c52db8f53125d1701f91191fb3","spanId":"25d1701f91191fb3"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
Note:
if environment.spring.rabbitmq.virtual-host: guest is removed in application.yml then MDC info gets populated in the log.
Attached my spring boot 3 application with rabbitMQ and micrometer tracing, its a spring web application. Dummy.zip
Here traceID / spanID is not propagating to other threads for the events listeners. For the first event I am getting traceID/spanID but for subsequent event no tracing info. On analysis found that using different virtual-host in the binders for the queues blocks the tracing observation.
Log for event with Binder and specific virtual-cost (guest)
{"timestamp":"2024-02-27 13:34:26.638","level":"INFO","thread":"test-event-5","mdc":{"traceId":"65dd978a1c793d43931890ba4748e045","spanId":"931890ba4748e045"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"} {"timestamp":"2024-02-27 13:34:33.075","level":"INFO","thread":"test-event-3","logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
Log for event with Binder and common virtual-cost (application)
{"timestamp":"2024-02-27 13:26:44.835","level":"INFO","thread":"test-event-4","mdc":{"traceId":"65dd95bc7e86db9acb0ce5ac20ed8800","spanId":"e00226a44cb852f2"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"} {"timestamp":"2024-02-27 13:26:53.533","level":"INFO","thread":"test-event-10","mdc":{"traceId":"65dd95c52db8f53125d1701f91191fb3","spanId":"25d1701f91191fb3"},"logger":"check.TestEventListener","message":"Handling handlerWithBinder with content","context":"default"}
Note: if environment.spring.rabbitmq.virtual-host: guest is removed in application.yml then MDC info gets populated in the log.