Closed davidjulien closed 2 years ago
@davidjulien Hello, this change looks great, thank you! Who is setting span_id and trace_id in the Logger metadata? I'm thinking if we can make this change in some backwards-compatible way so that we won't break existing filters for people that use this
Hi !
I'm using LoggerJSON with Spandex.
I think it's normal to have span_id
and trace_id
keys in metadata when you log a message. However, according to the documentation, Datadog requires dd.span_id
and dd.trace_id
keys to connect your traces with your logs. It doesn't work when you use span_id
and trace_id
keys. All examples in other languages use dd.span_id
and dd.trace_id
: java, ruby ...
But you're right. To keep backward compatibility, we can keep span_id
and trace_id
keys and add two new keys (dd.trace_id
and dd.span_id
). Is it ok for you ?
@davidjulien I think we can break the compatibility if it's set by Spandex, since it's just for DataDog. We can release a major version for that so that people check this change before upgrading.
Please try the master branch and tell me if everything goes smooth (or not), I'll release a hex version a bit later.
Thank you @AndrewDryga . It's working as expected. I have an other PR to submit before you build a new release.
Otherwise datadog is unable to link a log entry to the corresponding trace. See https://docs.datadoghq.com/tracing/faq/why-cant-i-see-my-correlated-logs-in-the-trace-id-panel/?tab=jsonlogs : "ensure the name of the logs attribute that contains the trace id is dd.trace_id"