Skip to content

Including trace ID in log messages #1274

Description

@blindmonkey

Hi team!

We're currently using RUM, the network interceptor, and logging, and are trying to make these play nice together. The use case that we're trying to figure out right now is that we use the logger to notify of network request failures, which may include a failure to parse the response. When such an error occurs, it's properly interleaved in the RUM view and that's super helpful. However, the log message doesn't get associated with the network trace, and it's not clear how to make this happen.

I've also tried creating a span and using span.log, but that just doesn't show anywhere -- not in RUM, and not in APM, and certainly not in the trace view for the relevant request. There doesn't really seem to be any good way to get a reference to either the span for the actual network request, or the trace ID; so my current plan is to propagate the URLRequest to our outer network layer, extract the trace ID from the headers, send it as a custom attribute, and configure Datadog to use that as per this documentation I found.

However, this seems like a fairly common use case, so I find myself wondering.. are we missing something obvious?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions