Skip to content

SQS trace header fails for unsampled traces #213

Closed
@jimjshields

Description

@jimjshields

We're using the XRay SDK for tracing our Django apps, which use SQS for asynchronous work. For the most part, it's sending traces of Django requests successfully and we can see them in the console.

However, we had an unsampled request that happened to interact with SQS, and it failed with this error:

ClientError("An error occurred (InvalidParameterValue) when calling the GetQueueUrl operation: The request has a 'X-Amzn-Trace-Id' HTTP header which is reserved for AWS X-Ray trace header and has an invalid value 'Root=dummy;Parent={real_parent_id};Sampled=0'",)

It seems like unsampled requests get the Root of dummy, which seems to cause this validation exception in SQS. Ideally, it'd either have a real ID, or that header wouldn't be injected for unsampled requests.

We have:

  • python: 3.6.5
  • aws-xray-sdk: 2.4.2
  • boto3: 1.9.230
  • botocore: 1.12.253
  • django: 2.0.4

Here's our configuration in settings.py:

XRAY_RECORDER = {
    'AWS_XRAY_DAEMON_ADDRESS': f"{EC2_PRIVATE_IP}:{XRAY_PORT}",
    'AWS_XRAY_TRACING_NAME': xray_tracing_name,
    'AWS_XRAY_CONTEXT_MISSING': 'LOG_ERROR',
    'PATCH_MODULES': [
        'boto3',
        'requests'
    ],
    'PLUGINS': ('EC2Plugin', 'ECSPlugin')
}

And the SDK is in our INSTALLED_APPS and MIDDLEWARE.

Let me know if you need more information. Thanks for the work on this library, I think it'll help us a lot!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions