Skip to content

Fix message handler spans appear disconnected from the incoming SQS trace#11511

Draft
ygree wants to merge 2 commits into
masterfrom
ygree/aws-sdk-sqs-bug
Draft

Fix message handler spans appear disconnected from the incoming SQS trace#11511
ygree wants to merge 2 commits into
masterfrom
ygree/aws-sdk-sqs-bug

Conversation

@ygree
Copy link
Copy Markdown
Contributor

@ygree ygree commented May 30, 2026

What Does This Do

Add regression test for sync SQS receive response copy context loss
Preserve SQS receive context across AWS SDK response rebuilding

Motivation

  • message handling spans are not attached to an SQS consume/inbound span
  • trace continuity from producer to consumer is broken
  • extracted upstream context and time-in-queue are lost
  • the app still processes messages, but Datadog shows handler work as detached roots or under the wrong active span instead of under the SQS receive/consume flow

Additional Notes

Contributor Checklist

  • Format the title according to the contribution guidelines
  • Assign the type: and (comp: or inst:) labels in addition to any other useful labels
  • Avoid using close, fix, or any linking keywords when referencing an issue
    Use solves instead, and assign the PR milestone to the issue
  • Update the CODEOWNERS file on source file addition, migration, or deletion
  • Update public documentation with any new configuration flags or behaviors
  • Add your completed PR to the merge queue by commenting /merge. You can also:
    • Customize the commit message associated with the merge with /merge --commit-message "..."
    • Remove your PR from the merge queue with /merge -c
    • Skip all merge queue checks with /merge -f --reason "reason"; please use this judiciously, as some checks do not run at the PR-level
    • Get more information in this doc

Jira ticket: APMS-19562

@ygree ygree self-assigned this May 30, 2026
@ygree ygree added type: bug Bug report and fix inst: aws sdk AWS SDK instrumentation labels May 30, 2026
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 30, 2026

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.08 s 14.05 s [-1.2%; +1.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.91 s 13.01 s [-1.6%; +0.0%] (no difference)
startup:petclinic:appsec:Agent 15.46 s 16.57 s [-14.9%; +1.5%] (unstable)
startup:petclinic:iast:Agent 16.50 s 16.57 s [-1.5%; +0.7%] (no difference)
startup:petclinic:profiling:Agent 16.26 s 16.45 s [-2.4%; +0.1%] (no difference)
startup:petclinic:tracing:Agent 15.68 s 15.62 s [-0.8%; +1.6%] (no difference)

Commit: 2fffa017 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@datadog-datadog-prod-us1

This comment has been minimized.

ygree added 2 commits May 29, 2026 18:16
Store the receive queue URL before the SDK rebuilds
ReceiveMessageResponse
and propagate it through the response builder so messages() can still
wrap
the final list in TracingList.

Also avoid wrapping messages during the SDK's internal
MessageMD5ChecksumInterceptor pass to prevent creating consumer spans
before user code actually consumes the messages.
@ygree ygree force-pushed the ygree/aws-sdk-sqs-bug branch from 2cacb35 to 2fffa01 Compare May 30, 2026 01:31
@ygree ygree changed the title Message handler spans appear disconnected from the incoming SQS trace Fix message handler spans appear disconnected from the incoming SQS trace May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inst: aws sdk AWS SDK instrumentation type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant