Skip to content

SQS: add automatic propagation of AWSTraceHeader attribute when sending message #12810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

bentsku
Copy link
Contributor

@bentsku bentsku commented Jun 27, 2025

Motivation

While reading about SQS and X-Ray, I had a hunch we didn't implement the automatic passing of X-Ray headers to the Attributes.
See https://docs.aws.amazon.com/xray/latest/devguide/xray-services-sqs.html

It might have been the case in the past, due to this following function:

def create_sqs_system_attributes(headers: Dict[str, str]) -> Dict[str, Any]:
system_attributes = {}
if "X-Amzn-Trace-Id" in headers:
system_attributes["AWSTraceHeader"] = {
"DataType": "String",
"StringValue": str(headers["X-Amzn-Trace-Id"]),
}
return system_attributes

But this was lacking now.
I've added a test to verify the behavior in AWS.

Changes

  • add automatic propagation from incoming request headers to AWSTraceHeader Attribute

@bentsku bentsku added this to the 4.6 milestone Jun 27, 2025
@bentsku bentsku self-assigned this Jun 27, 2025
@bentsku bentsku added aws:sqs Amazon Simple Queue Service semver: patch Non-breaking changes which can be included in patch releases labels Jun 27, 2025
Copy link

github-actions bot commented Jun 27, 2025

Test Results - Preflight, Unit

21 744 tests  ±0   20 087 ✅ ±0   6m 13s ⏱️ -4s
     1 suites ±0    1 657 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 1b82769. ± Comparison against base commit 5b0180c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 27, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 6s ⏱️ ±0s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 1b82769. ± Comparison against base commit 5b0180c.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 27, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   1h 32m 32s ⏱️
3 159 tests 3 028 ✅ 131 💤 0 ❌
3 170 runs  3 033 ✅ 137 💤 0 ❌

Results for commit 1b82769.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jun 27, 2025

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   1h 4m 41s ⏱️ - 40m 4s
3 134 tests  - 1 769  3 001 ✅  - 1 127  133 💤  - 642  0 ❌ ±0 
3 140 runs   - 1 765  3 005 ✅  - 1 123  135 💤  - 642  0 ❌ ±0 

Results for commit 1b82769. ± Comparison against base commit 5b0180c.

This pull request removes 1771 and adds 2 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.sqs.test_sqs.TestSqsProvider ‑ test_aws_trace_header_propagation[sqs]
tests.aws.services.sqs.test_sqs.TestSqsProvider ‑ test_aws_trace_header_propagation[sqs_query]

♻️ This comment has been updated with latest results.

@bentsku bentsku force-pushed the add-sqs-xray-propagation branch from c289098 to 1b82769 Compare June 27, 2025 13:57
@bentsku bentsku marked this pull request as ready for review June 27, 2025 14:44
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks for adding this!

@thrau thrau merged commit 05a922a into master Jun 27, 2025
39 checks passed
@thrau thrau deleted the add-sqs-xray-propagation branch June 27, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:sqs Amazon Simple Queue Service semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants