Book-Microservices-v2 / update-2.4.0

Update package: Spring Boot 2.4.0, Spring Cloud 2020.0, JDK 15, and more
13 stars 6 forks source link

#2 Fix traceability issue #4

Closed mechero closed 3 years ago

mechero commented 3 years ago

After upgrading to Spring Boot 2.4 and Spring Cloud 2020.0, the trace id correlation doesn't work as before. Probably the logback's AmqpAppender provided by Spring is working differently.

I don't think this is a bug in Spring; I was taking advantage of getting the same traceId values in the RabbitMQ messages consumed by the centralized logger, but this implementation was quite fragile.

What I'm doing now is simpler and more robust. Instead of getting the Sleuth metadata in the logs microservice, I'm just propagating it in the messages as they get produced. This way, I don't even need Sleuth in the centralized logger, which implementation should be kept as dumb as possible.

mi2shiii commented 3 years ago

Shouldn't been this pull request merged already @mechero ?

mechero commented 3 years ago

Yes, I missed this one after publishing the changes in the blog post. Thanks!