Open
Description
Expected Behavior
patch-console.ts adds dd
key and value to the log if it is json formatted (and possibly only if log args are length 1 too?).
dd: {
trace_id: traceId
span_id: parentId
}
Actual Behavior
Converts json object to a string representation and prefixes with [dd.trace_id=${traceId} dd.span_id=${parentId}]
, resulting in loss of datadog json log functionality.
Steps to Reproduce the Problem
- Send a json formatted log
- View the log in datadog and see that it has turned into a string representation in the message and unable to use datadog json parsing features
Workaround
- Turn off log injection with environmental variable:
DD_LOGS_INJECTION: false
- Import
dd-trace
from lambda layer - Set dd key and value
const context = tracer.scope().active()?.context();
const log = {
dd: {
trace_id: context?.toTraceId(),
span_id: context?.toSpanId(),
},
// ... other log keys and values
};
Metadata
Metadata
Assignees
Labels
No labels