Skip to content

feat(dsm): context support for sns #13605

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michael-zhao459
Copy link
Contributor

Added the proper support based on AWS message event format for sns -> lambda, as well as sns -> sqs -> lambda
This allows dsm to properly extract the neccessary context for lambda support

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jun 5, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/add-complete-sns-sqs-lambda-dsm-context-support-aa96ac74692ceb48.yaml  @DataDog/apm-python
ddtrace/internal/datastreams/botocore.py                                @DataDog/data-streams-monitoring
tests/datastreams/test_botocore.py                                      @DataDog/data-streams-monitoring

@michael-zhao459 michael-zhao459 changed the title feat(dsm): Add DSM support for lambda and SNS feat(dsm): context support for sns Jun 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 287 ± 7 ms.

The average import time from base is: 288 ± 6 ms.

The import time difference between this PR and base is: -1.5 ± 0.3 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.894 ms (0.66%)
ddtrace.bootstrap.sitecustomize 1.243 ms (0.43%)
ddtrace.bootstrap.preload 1.243 ms (0.43%)
ddtrace.internal.remoteconfig.client 0.646 ms (0.23%)
ddtrace 0.651 ms (0.23%)

@pr-commenter
Copy link

pr-commenter bot commented Jun 5, 2025

Benchmarks

Benchmark execution time: 2025-06-05 14:23:49

Comparing candidate commit 9039d15 in PR branch michael.zhao/lambda-support with baseline commit 0e5abc9 in branch main.

Found 0 performance improvements and 4 performance regressions! Performance is the same for 549 metrics, 3 unstable metrics.

scenario:iastaspects-lstrip_aspect

  • 🟥 execution_time [+1.340µs; +1.426µs] or [+10.278%; +10.944%]

scenario:iastaspects-rstrip_aspect

  • 🟥 execution_time [+1.132µs; +1.419µs] or [+8.826%; +11.063%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+726.435ns; +843.968ns] or [+17.057%; +19.817%]

scenario:iastaspectsospath-ospathsplitext_aspect

  • 🟥 execution_time [+552.984ns; +661.375ns] or [+12.194%; +14.584%]

context_json = json.loads(datadog_attr["stringValue"])
elif "BinaryValue" in datadog_attr:
# Raw message delivery
context_json = json.loads(datadog_attr["BinaryValue"].decode())
elif "binaryValue" in datadog_attr:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it actually valid to expect both this and line 185? Seems like they could be condensed into a single condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can confirm that binaryValue is needed for sns -> sqs -> lambda but am worried about getting rid of the previous condition of BinaryValue, there are too many configurations that could result in the other state being accurate, if possible I would appreciate keeping both conditions

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.

3 participants