Skip to content

Conversation

@smola
Copy link
Member

@smola smola commented May 7, 2025

Use more robust method to filter out frames from ddtrace module. The previous version would not work in some tests if the relevant frame was in site-packages within a virtual env named ddtrace, which happens in tests for #13256. This would generally not affect customers, but misbehaves in our test suite.

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

@smola smola added changelog/no-changelog A changelog entry is not required for this PR. ASM Application Security Monitoring labels May 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

CODEOWNERS have been resolved as:

ddtrace/appsec/_iast/_stacktrace.c                                      @DataDog/asm-python
tests/appsec/integrations/pygoat_tests/test_pygoat.py                   @DataDog/asm-python

@smola smola changed the title fix(iast): fix stacktrace issues chore(iast): fix stacktrace issues May 7, 2025
@smola smola changed the title chore(iast): fix stacktrace issues fix(iast): fix stacktrace issues May 7, 2025
@smola smola changed the title fix(iast): fix stacktrace issues chore(iast): fix stacktrace issues May 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 238 ± 5 ms.

The average import time from base is: 245 ± 4 ms.

The import time difference between this PR and base is: -6.7 ± 0.2 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 2.518 ms (1.06%)
ddtrace.bootstrap.sitecustomize 1.736 ms (0.73%)
ddtrace.bootstrap.preload 1.736 ms (0.73%)
ddtrace.internal.products 1.736 ms (0.73%)
ddtrace.internal.remoteconfig.client 0.754 ms (0.32%)
ddtrace 0.782 ms (0.33%)
ddtrace._logger 0.098 ms (0.04%)
logging 0.098 ms (0.04%)
traceback 0.098 ms (0.04%)
contextlib 0.098 ms (0.04%)

@pr-commenter
Copy link

pr-commenter bot commented May 7, 2025

Benchmarks

Benchmark execution time: 2025-05-07 16:41:16

Comparing candidate commit 591c2f1 in PR branch smola/fix-stacktrace-iast with baseline commit 57cf21f in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 394 metrics, 8 unstable metrics.

@smola smola changed the title chore(iast): fix stacktrace issues chore(iast): improve detection of ddtrace frames May 7, 2025
@smola smola force-pushed the smola/fix-stacktrace-iast branch from f6546dd to 517ee65 Compare May 7, 2025 14:20
@smola smola force-pushed the smola/fix-stacktrace-iast branch from 8b8139e to 591c2f1 Compare May 7, 2025 15:52
@smola smola marked this pull request as ready for review May 7, 2025 15:59
@smola smola requested a review from a team as a code owner May 7, 2025 15:59
@smola smola enabled auto-merge (squash) May 7, 2025 17:36
@smola smola merged commit bf8e827 into main May 7, 2025
407 checks passed
@smola smola deleted the smola/fix-stacktrace-iast branch May 7, 2025 18:06
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

The backport to 2.21 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.21 2.21
# Navigate to the new working tree
cd .worktrees/backport-2.21
# Create a new branch
git switch --create backport-13344-to-2.21
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 bf8e827d62c24eee36d8ce6ca78cc4411e759b5b
# Push it to GitHub
git push --set-upstream origin backport-13344-to-2.21
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.21

Then, create a pull request where the base branch is 2.21 and the compare/head branch is backport-13344-to-2.21.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ASM Application Security Monitoring backport 2.21 changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants