Skip to content
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

feat: propagate trace-context for SQS and SNS in MessageAttributes #3044

Merged
merged 5 commits into from Jan 23, 2023

Conversation

trentm
Copy link
Member

@trentm trentm commented Nov 25, 2022

Propagate trace-context in SQS and SNS MessageAttributes, if there is
enough room (max 10 message attributes). Otherwise log.warn.
Spec: https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-aws.md#distributed-tracing

Closes: #2021

Checklist

Propagate trace-context in SQS and SNS MessageAttributes, if there is
enough room (max 10 message attributes). Otherwise log.warn.
Spec: https://github.com/elastic/apm/blob/main/specs/agents/tracing-instrumentation-aws.md#distributed-tracing

Closes: #2021
@trentm trentm self-assigned this Nov 25, 2022
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Nov 25, 2022
@elastic-apm-tech elastic-apm-tech added this to In Progress in APM-Agents (OLD) Nov 25, 2022
@apmmachine
Copy link
Collaborator

apmmachine commented Nov 25, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-19T19:22:19.298+0000

  • Duration: 24 min 41 sec

Test stats 🧪

Test Results
Failed 0
Passed 323202
Skipped 0
Total 323202

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run module tests for <modules> : Run TAV tests for one or more modules, where <modules> can be either a comma separated list of modules (e.g. memcached,redis) or the string literal ALL to test all modules

  • run benchmark tests : Run the benchmark test only.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

… context even if no span is created (e.g. if unsampled transaction)
@trentm
Copy link
Member Author

trentm commented Jan 19, 2023

Some screenshots showing this working for SNS:

  1. I have an "examples/trace-sns-publish.js" script that publishes a message to an SNS topic:
% node examples/trace-sns-publish.js us-west-2 trentm-play-topic1
SNS Publish to region=us-west-2 topicName=trentm-play-topic1
topicArn: arn:aws:sns:us-west-2:[REDACTED]:trentm-play-topic1
Publishing with message: "this is my message (0.1799853931829758)"
publish response data: {
  ResponseMetadata: { RequestId: 'a9de436a-d630-5515-9e0d-1f2940452da6' },
  MessageId: '5c48ac30-2d4d-5b23-a988-f073bb38f390'
}

Screen Shot 2023-01-19 at 11 08 55 AM

  1. That is received by an SNS trigger on a Lambda function of mine.

Screen Shot 2023-01-19 at 11 10 01 AM

with the connection linked in the Span links tab of the Span details flyover:

Screen Shot 2023-01-19 at 11 10 42 AM

@trentm trentm marked this pull request as ready for review January 19, 2023 19:22
@trentm trentm merged commit b9d816b into main Jan 23, 2023
APM-Agents (OLD) automation moved this from In Progress to Done Jan 23, 2023
@trentm trentm deleted the trentm/sqs-trace-context-prop branch January 23, 2023 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
Development

Successfully merging this pull request may close these issues.

Amazon SQS: Automatic Propagation of Headers
2 participants