You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to instrument my Cloud Run (google serverless) but I can't get the logs to correlate with the traces.
Describe what happened:
I have tried several options such as using this small library in contrib with logrus. https://github.com/DataDog/dd-trace-go/blob/main/contrib/sirupsen/logrus/logrus.go
And the log does not show the same dd.trace_id than the traces UI.
Like on this picture:
What I find suspicious is that the trace_id seems very similar, so it can't come from a completely different trace in the code because if I've understood correctly it's randomly generated in the dd-trace lib.
In addition, I have the feeling that this ID is rounded off to end with ...00
Steps to reproduce the issue:
As I said, I've tried using bot DDContextLogHook library from contrib and the manual method of inserting the trace ID into the logs but I get the same result.
Here's my code snippet which I assume should work:
Hello @Vlaquit, I'm not sure how logrus works internally, but make sure that your trace_id is sent as a string. Json encoding in go using encoding/json may lose precision on big integers, since the conversion is internally using float64. Let me know if that fixes the issue!
Thank you, it seems to work when I cast the TraceID to string! (BTW I forgot to check that the remapping was fine. The trace id reserved attribute remapper was not parsing the data.jsonPayload.dd.trace_id properly) 🙏🏻
However I had the same problem with the contrib/logrus lib, I think the bug could still occur when you want to use it.
Hello, I'm trying to instrument my Cloud Run (google serverless) but I can't get the logs to correlate with the traces.
Describe what happened:
I have tried several options such as using this small library in contrib with logrus.
https://github.com/DataDog/dd-trace-go/blob/main/contrib/sirupsen/logrus/logrus.go
And the log does not show the same
dd.trace_id
than the traces UI.Like on this picture:
What I find suspicious is that the trace_id seems very similar, so it can't come from a completely different trace in the code because if I've understood correctly it's randomly generated in the dd-trace lib.
In addition, I have the feeling that this ID is rounded off to end with
...00
Steps to reproduce the issue:
As I said, I've tried using bot
DDContextLogHook
library from contrib and the manual method of inserting the trace ID into the logs but I get the same result.Here's my code snippet which I assume should work:
I have logrus configured with the json formatter with this
logger.SetFormatter(&logrus.JSONFormatter{})
Additional environment details (Version of Go, Operating System, etc.):
I am using go 1.19
The golang:1.19-buster Docker image
The text was updated successfully, but these errors were encountered: