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

bugfix: AWS Lambda event source key incorrect for SNS in instrumenta… #2612

Merged
merged 8 commits into from
Jun 20, 2024

Conversation

zhihali
Copy link
Contributor

@zhihali zhihali commented Jun 15, 2024

…tion library.

Description

Fixes #2511

In AWS doc: https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html, The SNS message event looks like:

{
  "Records": [
    {
      "EventVersion": "1.0",
      "EventSubscriptionArn": "arn:aws:sns:us-east-1:123456789012:sns-lambda:21be56ed-a058-49f5-8c98-aedd2564c486",
      "EventSource": "aws:sns",
      "Sns": {
......

but the code will just check eventSource(which applicable in sqs, s3 and dynamodb) but not EventSource. So I add code to check the EventSource, make sure the SNS's span id will be SpanKind.CONSUMER but not SpanKind.SERVER

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

tox -e py39-test-instrumentation-aws-lambda

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@zhihali zhihali requested a review from a team June 15, 2024 10:52
@xrmx xrmx requested a review from srprash June 17, 2024 08:26
@xrmx
Copy link
Contributor

xrmx commented Jun 17, 2024

Please setup pre-commit as written in CONTRIBUTING.md to avoid basic lint issues

@lzchen lzchen merged commit a61739c into open-telemetry:main Jun 20, 2024
365 checks passed
@zhihali zhihali deleted the bugfix-2511 branch June 24, 2024 15:44
xrmx pushed a commit to xrmx/opentelemetry-python-contrib that referenced this pull request Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS Lambda event source key incorrect for SNS in instrumentation library.
4 participants