DataDog / dd-sdk-android

Datadog SDK for Android (Compatible with Kotlin and Java)
Apache License 2.0
146 stars 59 forks source link

ValueError: Invalid traceparent version #2124

Closed ema987 closed 1 month ago

ema987 commented 1 month ago

Describe the bug

Android SDK: v2.10.1

It seems that the Android sdk is not creating valid values for the traceparent header.

The given error is actually generated by the dd-trace-py library, but we are seeing it only on requests coming from Android clients, so we expect this to be an issue with the Android sdk, even because the regex mentioned here in the python library seems to match what specified here.

The incriminated code should be this one here which unfortunately changed completely from version 2.10.1 to 2.11.0 here but couldn't find mentioning this bug fixed in the changelog.

I'm going to upgrade to v2.11.0 and see if anything changes, but I though it was worth to report this issue to you if any action needs to be taken.

Reproduction steps

N/A

Logcat logs

ValueError: Invalid traceparent version: 00-00000000000001834287212453236061-7485915525997446545-00
  File "ddtrace/propagation/http.py", line 785, in _extract
    trace_id, span_id, trace_flag = _TraceContext._get_traceparent_values(tp)
  File "ddtrace/propagation/http.py", line 664, in _get_traceparent_values
    raise ValueError("Invalid traceparent version: %s" % tp)

received invalid w3c traceparent: 00-00000000000001834287212453236061-7485915525997446545-00 , 64 additional messages skipped

Expected behavior

Expected value example: 00-00000000000006164470909947554606-8313961160985324-00 Actual value example: 00-00000000000001834287212453236061-7485915525997446545-00

Affected SDK versions

2.10.1

Latest working SDK version

N/A

Did you confirm if the latest SDK version fixes the bug?

No

Kotlin / Java version

No response

Gradle / AGP version

No response

Other dependencies versions

No response

Device Information

No response

Other relevant information

No response

mariusc83 commented 1 month ago

Hi @ema987, thank you for taking the time to report this issue. We are actually aware of it and is currently in progress. It will be fixed in our next release. We will keep you posted. Just FYI this is only happening if the sampling rate is 0 from the client side.

mariusc83 commented 1 month ago

I am closing this as the fix will be released in the next version of the SDK. @ema987 please let us know if you still encounter the issue after adopting the next version (it will be available in the next 2 weeks).

ema987 commented 1 week ago

Hey @mariusc83 , sorry to bother you again, but it seems this issue is not fixed: we are still seeing it in our Sentry logs even with the latest update 2.12.0 of the sdk.

Invalid traceparent version: 00-66cdcb3f000000002859aa2a21da1a76-8148091846247771200-00

Screenshot 2024-08-27 at 16 55 06

What else can I provide you that might help identify the issue?

I've also checked the sampling rate you mentioned above but I'm pretty sure we don't set it to 0. Could you help clarify where this should be set to cause this error to happen?

Thank you very much