DataDog / datadog-lambda-python

The Datadog AWS Lambda Layer for Python
https://docs.datadoghq.com/integrations/amazon_lambda/#installing-and-using-the-datadog-layer
Apache License 2.0
88 stars 46 forks source link

New field Lineage in _X_AMZN_TRACE_ID #309

Closed leandrostasi-jt closed 1 year ago

leandrostasi-jt commented 1 year ago

Expected Behavior

Datadog _before function runs without issues.

Actual Behavior

Error in Execution

Steps to Reproduce the Problem

  1. Execute any lambda function with Datadog Lambda Layer

Specifications

Stacktrace

 File "/opt/python/lib/python3.9/site-packages/datadog_lambda/wrapper.py", line 262, in _before
set_correlation_ids()
File "/opt/python/lib/python3.9/site-packages/datadog_lambda/tracing.py", line 527, in set_correlation_ids
span.trace_id = int(context[TraceHeader.TRACE_ID])
KeyError: 'x-datadog-trace-id'

xray.py:47 def parse_xray_header(raw_trace_id): Expected Data # Root=1-5e272390-8c398be037738dc042009320;Parent=94ae789b969f1cc5;Sampled=1 Actual Data # Root=1-64131161-09bc41d16558864e0c28efe5;Parent=62c487e3070d2d5b;Sampled=1;Lineage=c6c5b1b9:0

astuyve commented 1 year ago

Hi @leandrostasi-jt - thanks for reaching out, I'll update this ticket when we have a fix.

For now I'd suggest disabling x-ray and relying on Datadog Tracing until we can perform a release.

leandrostasi-jt commented 1 year ago

Thank you! @astuyve

ebarti commented 1 year ago

@astuyve We are facing the same issue but we do NOT have x-ray enabled (nor we have the intention of enabling datadog tracing). What do we do here? This is cluttering our logs and we spent some time until we figured out this error has no effect on the execution as it is wrapped in a try-catch block, however we'd like to remove them from our logs.

astuyve commented 1 year ago

@ebarti - please verify that DD_MERGE_XRAY_TRACES is not set, or set to false.

A fix for this has been released in v69, you can upgrade to remove this error.