mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [@kbn/profiler-cli: collect and display CPU profiles (#216356)](https://github.com/elastic/kibana/pull/216356) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Dario Gieselaar","email":"dario.gieselaar@elastic.co"},"sourceCommit":{"committedDate":"2025-04-02T06:47:33Z","message":"@kbn/profiler-cli: collect and display CPU profiles (#216356)\n\n# @kbn/profiler-cli\n\nProfile Kibana while it's running, and open the CPU profile in\nSpeedscope.\n\n## Usage\n\nRun a command by either preceding it with the profiler script:\n`node scripts/profile.js -- $command`\n\nOr by piping it in:\n`$command | node scripts/profile.js`\n\nYou can also just run it until SIGINT:\n\n`node scripts/profile.js`\n\nOr with a timeout:\n\n`node scripts/profile.js --timeout=10000`\n\n## Examples\n\n### Commands\n\nYou can copy a curl request from the browser, and place it after the\ncommand:\n\n`node scripts/profile.js --connections=10 --amount=50 -- curl ...`\n\nYou can also use stdin for this, for example:\n\n`pbpaste | node scripts/profile.js`\n\nWhen using stdin, take into consideration that there is some lag between\nstarting the script and connecting the profiler, so the profiler might\nmiss the first second or so of the running process.\n\nYou can also use any other command, like `autocannon`, `sleep` or\n`xargs`.\n\n### SigInt\n\nBy default, the profiler will run until the process exits:`node\nscripts/profile.js`. This is useful when you have a long running process\nrunning separately and you want to collect the profile over a longer\ntime period. Be aware that this might cause memory issues because the\nprofile will get huge. When you press Cmd+C, the profiler will\ngracefully exit and first write the profile to disk and open Speedscope.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1493b98e71db3a66014e29ba3264fcf21155f2e","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"@kbn/profiler-cli: collect and display CPU profiles","number":216356,"url":"https://github.com/elastic/kibana/pull/216356","mergeCommit":{"message":"@kbn/profiler-cli: collect and display CPU profiles (#216356)\n\n# @kbn/profiler-cli\n\nProfile Kibana while it's running, and open the CPU profile in\nSpeedscope.\n\n## Usage\n\nRun a command by either preceding it with the profiler script:\n`node scripts/profile.js -- $command`\n\nOr by piping it in:\n`$command | node scripts/profile.js`\n\nYou can also just run it until SIGINT:\n\n`node scripts/profile.js`\n\nOr with a timeout:\n\n`node scripts/profile.js --timeout=10000`\n\n## Examples\n\n### Commands\n\nYou can copy a curl request from the browser, and place it after the\ncommand:\n\n`node scripts/profile.js --connections=10 --amount=50 -- curl ...`\n\nYou can also use stdin for this, for example:\n\n`pbpaste | node scripts/profile.js`\n\nWhen using stdin, take into consideration that there is some lag between\nstarting the script and connecting the profiler, so the profiler might\nmiss the first second or so of the running process.\n\nYou can also use any other command, like `autocannon`, `sleep` or\n`xargs`.\n\n### SigInt\n\nBy default, the profiler will run until the process exits:`node\nscripts/profile.js`. This is useful when you have a long running process\nrunning separately and you want to collect the profile over a longer\ntime period. Be aware that this might cause memory issues because the\nprofile will get huge. When you press Cmd+C, the profiler will\ngracefully exit and first write the profile to disk and open Speedscope.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1493b98e71db3a66014e29ba3264fcf21155f2e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216356","number":216356,"mergeCommit":{"message":"@kbn/profiler-cli: collect and display CPU profiles (#216356)\n\n# @kbn/profiler-cli\n\nProfile Kibana while it's running, and open the CPU profile in\nSpeedscope.\n\n## Usage\n\nRun a command by either preceding it with the profiler script:\n`node scripts/profile.js -- $command`\n\nOr by piping it in:\n`$command | node scripts/profile.js`\n\nYou can also just run it until SIGINT:\n\n`node scripts/profile.js`\n\nOr with a timeout:\n\n`node scripts/profile.js --timeout=10000`\n\n## Examples\n\n### Commands\n\nYou can copy a curl request from the browser, and place it after the\ncommand:\n\n`node scripts/profile.js --connections=10 --amount=50 -- curl ...`\n\nYou can also use stdin for this, for example:\n\n`pbpaste | node scripts/profile.js`\n\nWhen using stdin, take into consideration that there is some lag between\nstarting the script and connecting the profiler, so the profiler might\nmiss the first second or so of the running process.\n\nYou can also use any other command, like `autocannon`, `sleep` or\n`xargs`.\n\n### SigInt\n\nBy default, the profiler will run until the process exits:`node\nscripts/profile.js`. This is useful when you have a long running process\nrunning separately and you want to collect the profile over a longer\ntime period. Be aware that this might cause memory issues because the\nprofile will get huge. When you press Cmd+C, the profiler will\ngracefully exit and first write the profile to disk and open Speedscope.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"d1493b98e71db3a66014e29ba3264fcf21155f2e"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
15 lines
665 B
JavaScript
15 lines
665 B
JavaScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the "Elastic License
|
|
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
|
|
* Public License v 1"; you may not use this file except in compliance with, at
|
|
* your election, the "Elastic License 2.0", the "GNU Affero General Public
|
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
|
*/
|
|
|
|
require('@babel/register')({
|
|
extensions: ['.ts', '.js'],
|
|
presets: [['@babel/preset-env', { targets: { node: 'current' } }], '@babel/preset-typescript'],
|
|
});
|
|
|
|
require('@kbn/profiler-cli/cli');
|