Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

Google Cloud Trace doesn't correlate logs from Spring Boot applications using Sleuth

I've recently upgraded my applications to Spring Boot 2.4.2, Cloud 2020.0.0, changing Spring Cloud GCP dependencies following the migration guide: https://googlecloudplatform.github.io/spring-cloud-gcp/2.0.0/reference/html/index.html#migration-guide-from-spring-cloud-gcp-1-x-to-2-x

Regarding the applications everything seems to be working fine. I can see calls between the microservices propagating the trace-id headers:

gateway:

2021-01-24 20:18:36.471 DEBUG [gateway,0bc6b9664e6604e2,eb9f834718fe33c9] 1 ---

service1:

2021-01-24 20:18:36.700 DEBUG [service1,0bc6b9664e6604e2,570653ac93add270,true]

In the Google Cloud Trace console I can see that the trace id (0bc6b9664e6604e2) was captured (prefixed with 16 extra 0's) and that it shows both microservices (the first post corresponds to gateway and the third call correspons to service1:

enter image description here

However notice the message "No logs found for this trace".

Also the Trace Logs View link complaints about it:

enter image description here

If I open the link it just looks by timestamp, not using the correlation trace id.

The funny thing is if I look for a log statement directly in the GCP Logging view, the trace id is there:

enter image description here

I can then run a GCP Logging query to find all the logs correctly:

enter image description here

Apparently everything seems to be OK. Could you tell why GCP Trace isn't able to correlate with GCP Logging?

question from:https://stackoverflow.com/questions/65875833/google-cloud-trace-doesnt-correlate-logs-from-spring-boot-applications-using-sl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...