spandex-project / spandex

A platform agnostic tracing library
MIT License
335 stars 53 forks source link

Log message does not correlate with the trace when trace_id and spand_id are included #118

Closed IvanRublev closed 4 years ago

IvanRublev commented 4 years ago

What's now:

Having the following lines in config.exs

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id, :trace_id, :span_id]

The trace produced with no logs associated Screenshot 2020-09-11 at 11 26 54

same time the trace id and span id are included in the log message. Screenshot 2020-09-11 at 11 28 03

Seems the format of log message is wrong, it should be dd.trace_id and dd.span_id according to the docs

What's expected

Log record is correlated and visible on the trace page.

hkrutzer commented 4 years ago

You should log as JSON and then configure trace id mapping in the pipeline configuration

image
GregMefford commented 4 years ago

There is also a place to do this globally, if you don't want to do it specifically for a particular pipeline. It's in the log configuration right after "Ingest API," before all the pipelines.

Please let us know if this fixes it for you! We're just now getting DD Logs set up where I work, so we haven't hit these kinds of issues yet in "real life."

https://app.datadoghq.com/logs/pipelines/remapping

image