spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
701 stars 697 forks source link

Facing issues with trace-id and span-id not being printed in logs when @LoadBalanced RestTemplate is used #1330

Closed curfew117 closed 6 months ago

curfew117 commented 6 months ago

Was referred from https://github.com/spring-projects/spring-boot/issues/39327

I recently migrated to Spring Boot 3.2, Spring Cloud 2023.0.0 and I'm having issues with trace-id and span-id not being printed in logs when a RestTemplate bean is annotated with @LoadBalanced.

The pic attached below is when a RestTemplate bean is created without the @LoadBalanced annotation and trace-id and span-id is included image

And the below pic when a RestTemplate is created with the @LoadBalanced annotation and trace-id and span-id is empty image

The log being printed above is a part of a @GetMapping whose controller has no dependency with the created RestTemplate.

I've attached the sample project I used to replicate the issue. demo.zip

OlgaMaciaszek commented 6 months ago

Hello @curfew117, thanks for reporting the issue. This is probably due to https://github.com/spring-cloud/spring-cloud-commons/issues/1315. Can you upgrade SC Commons to 4.1.1 and see if that helps?

curfew117 commented 6 months ago

Yes, it's working as expected when I upgrade SC Commons to 4.1.1. Thank you @OlgaMaciaszek

OlgaMaciaszek commented 6 months ago

Closing as duplicate of gh-1315.