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

Reduce allocations for formatting exception stack traces #178

Merged
merged 3 commits into from
Apr 26, 2022

Conversation

HaloFour
Copy link
Contributor

@HaloFour HaloFour commented Apr 5, 2022

Reduces the number of allocations when formatting exception stack traces.

  1. Accepts a CharSequence instead of a String so that an underlying StringBuilder can be passed directly without requiring an intermediate allocation.
  2. Reimplements EcsJsonSerializer#formatStackTraceAsArray to use Matcher to iterate over the CharSequence to avoid allocating the ArrayList<String>, String[] and each individual String element.

@github-actions github-actions bot added agent-java community Issues and PRs created by the community triage Issues and PRs that need to be triaged labels Apr 5, 2022
@apmmachine
Copy link
Contributor

apmmachine commented Apr 5, 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-04-26T14:42:05.193+0000

  • Duration: 8 min 40 sec

Test stats 🧪

Test Results
Failed 0
Passed 198
Skipped 0
Total 198

🤖 GitHub comments

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

  • /test : Re-trigger the build.

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

@eyalkoren
Copy link
Contributor

Thanks for this PR!
Please see HaloFour#1 which proposes some further allocation reduction.

Reduce stacktrace serialization allocations further
@HaloFour
Copy link
Contributor Author

Thanks for the assist! 😃

@eyalkoren eyalkoren merged commit 23d5bd6 into elastic:main Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-java community Issues and PRs created by the community triage Issues and PRs that need to be triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants