[8.x] @kbn/profiler-cli: collect and display CPU profiles (#216356)#216774
Merged
dgieselaar merged 2 commits intoelastic:8.xfrom Apr 3, 2025
Merged
[8.x] @kbn/profiler-cli: collect and display CPU profiles (#216356)#216774dgieselaar merged 2 commits intoelastic:8.xfrom
dgieselaar merged 2 commits intoelastic:8.xfrom
Conversation
# @kbn/profiler-cli Profile Kibana while it's running, and open the CPU profile in Speedscope. ## Usage Run a command by either preceding it with the profiler script: `node scripts/profile.js -- $command` Or by piping it in: `$command | node scripts/profile.js` You can also just run it until SIGINT: `node scripts/profile.js` Or with a timeout: `node scripts/profile.js --timeout=10000` ## Examples ### Commands You can copy a curl request from the browser, and place it after the command: `node scripts/profile.js --connections=10 --amount=50 -- curl ...` You can also use stdin for this, for example: `pbpaste | node scripts/profile.js` When using stdin, take into consideration that there is some lag between starting the script and connecting the profiler, so the profiler might miss the first second or so of the running process. You can also use any other command, like `autocannon`, `sleep` or `xargs`. ### SigInt By default, the profiler will run until the process exits:`node scripts/profile.js`. This is useful when you have a long running process running separately and you want to collect the profile over a longer time period. Be aware that this might cause memory issues because the profile will get huge. When you press Cmd+C, the profiler will gracefully exit and first write the profile to disk and open Speedscope. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit d1493b9) # Conflicts: # .github/CODEOWNERS # src/cli/dev.js
Contributor
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
|
neptunian
approved these changes
Apr 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.x:Questions ?
Please refer to the Backport tool documentation