Skip to content

Conversation

basepi
Copy link
Contributor

@basepi basepi commented Jul 21, 2022

What does this pull request do?

We use varmap() to apply shorten() recursively across a data structure. varmap() was recursing into the data structures, and then applying the func() (in this case, shorten()) on the way back out of recursion. This meant that when shortening local variables where just recursing over the data structure was a performance issue, setting ELASTIC_APM_LOCAL_VAR_LIST_MAX_LENGTH wouldn't actually affect the runtime, just the output.

With this change, dictionaries and lists will be shortened and then we'll iterate over their contents. Shouldn't affect _sanitize() at all, but will speed up shorten() considerably.

I think the test surface on this function is sufficient without adding tests for this fix.

Related issues

Closes #1592

@ghost
Copy link

ghost commented Jul 21, 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: 2022-07-21T23:16:47.661+0000

  • Duration: 26 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 4922
Skipped 3455
Total 8377

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • /test linters : Run the Python linters only.

  • /test full : Run the full matrix of tests.

  • /test benchmark : Run the APM Agent Python benchmarks tests.

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

@ghost
Copy link

ghost commented Jul 21, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (68/68) 💚
Files 100.0% (227/227) 💚
Classes 100.0% (227/227) 💚
Lines 89.642% (17257/19251) 👍 0.022
Conditionals 76.869% (3147/4094) 👍 0.098

Copy link
Contributor

@beniwohli beniwohli left a comment

Choose a reason for hiding this comment

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

Great catch! LGTM

@basepi basepi merged commit 79b58ce into elastic:main Jul 22, 2022
@basepi basepi mentioned this pull request Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance Bug in the varmap function
2 participants