GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp
Help to Give preference to x-cloud-trace-context in context propagation spring boot 3
- Dominant language
- Java
- Stars
- 551
- Forks
- 349
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
I have used stack driver logging in my application
https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#log-via-console
From my client I am getting http requests with x-cloud-trace-context, so in gcp cloud run request log it is considering x-cloud-trace-context as traceid. Inside my application x-b3-traceid is working as traceid. So under one request there are two traces
1. one at gcl cloud run req log level
2. second at my application level
How can I give preference to x-cloud-trace-context in my application so all logs will be under one trace.
https://googlecloudplatform.github.io/spring-cloud-gcp/reference/html/index.html#cloud-logging:~:text=If%20you%20need%20different%20propagation%20behavior%20(e.g.%20relying%20primarily%20on%20x%2Dcloud%2Dtrace%2Dcontext%20in%20a%20mixed%20Spring%20/%20non%2DSpring%20application%20environment)%2C%20Micrometer%20allows%20such%20customization%20through%20the%20CUSTOM%20propagation%20type.
Any code samples would be of great help
Dependencies used:
com.google.cloud:spring-cloud-gcp-dependencies:4.7.2
org.springframework.boot:spring-boot-dependencies:3.1.5
Contributor guide
Assessment
This issue has not been assessed yet.