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

chore(asm): avoid double calls on some aspect front-ends #9344

Merged
merged 8 commits into from
May 23, 2024

Conversation

juanjux
Copy link
Collaborator

@juanjux juanjux commented May 22, 2024

Description

Some aspects (index, slice, ljust, format, encode, decode and replace) were calling the original function and then potentially the native aspect, which would call again the original function. This reworks these aspect front-ends so only one call is ever done, which should improve performance a little.

This refactor also arised and error where we were not checking the CPython error with the new has_pyerror() helper in the native api_aspect_index so it fixed that too.

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • 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

@juanjux juanjux added changelog/no-changelog A changelog entry is not required for this PR. ASM Application Security Monitoring labels May 22, 2024
@juanjux juanjux self-assigned this May 22, 2024
@juanjux juanjux requested a review from a team as a code owner May 22, 2024 09:01
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented May 22, 2024

Datadog Report

Branch report: juanjux/APPSEC-53255-avoid-double-calls
Commit report: 3d05c3e
Test service: dd-trace-py

✅ 0 Failed, 109746 Passed, 3758 Skipped, 6m 25.39s Total duration (41m 56.16s time saved)

@pr-commenter
Copy link

pr-commenter bot commented May 22, 2024

Benchmarks

Benchmark execution time: 2024-05-22 12:02:47

Comparing candidate commit 2010dbf in PR branch juanjux/APPSEC-53255-avoid-double-calls with baseline commit 66b96e9 in branch main.

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

@juanjux juanjux closed this May 23, 2024
@juanjux juanjux reopened this May 23, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 14.49275% with 59 lines in your changes are missing coverage. Please review.

Project coverage is 10.25%. Comparing base (66b96e9) to head (3d05c3e).
Report is 8 commits behind head on main.

Files Patch % Lines
ddtrace/appsec/_iast/_taint_tracking/aspects.py 22.22% 35 Missing ⚠️
...s/appsec/iast/aspects/test_encode_decode_aspect.py 0.00% 18 Missing ⚠️
.../appsec/iast/aspects/test_index_aspect_fixtures.py 0.00% 3 Missing ⚠️
tests/appsec/iast/aspects/test_str_aspect.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9344       +/-   ##
===========================================
- Coverage   76.02%   10.25%   -65.77%     
===========================================
  Files        1294     1266       -28     
  Lines      122816   121219     -1597     
===========================================
- Hits        93370    12437    -80933     
- Misses      29446   108782    +79336     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@juanjux juanjux merged commit f251e5b into main May 23, 2024
112 of 118 checks passed
@juanjux juanjux deleted the juanjux/APPSEC-53255-avoid-double-calls branch May 23, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASM Application Security Monitoring 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