-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: Added multiple scripts to trigger profiles #35546
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
| set -o nounset | ||
| set -o noglob | ||
|
|
||
| location=/appsmith-stacks/heap_dumps/ad-hoc/$(date "+%Y_%m_%d_%H_%S")/heap-profile; | ||
| mkdir -p $location; | ||
| jcmd $(pgrep -f -- "-jar\sserver.jar") GC.heap_dump filename=$location/${HOSTNAME}.log | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
| set -o nounset | ||
| set -o noglob | ||
|
|
||
| location=/appsmith-stacks/heap_dumps/ad-hoc/$(date "+%Y_%m_%d_%H_%S")/thread-profile; | ||
| mkdir -p $location; | ||
| jcmd $(pgrep -f -- "-jar\sserver.jar") Thread.print > $location/trace-${HOSTNAME}.log | ||
|
Comment on lines
+8
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve error handling and directory creation checks. To ensure robustness, add checks for directory creation and process identification. Logging actions can also aid in debugging and traceability. location=/appsmith-stacks/heap_dumps/ad-hoc/$(date "+%Y_%m_%d_%H_%S")/thread-profile
mkdir -p "$location" || { echo "Error: Failed to create directory $location." >&2; exit 1; }
process_id=$(pgrep -f -- "-jar\sserver.jar" || echo "")
if [ -z "$process_id" ]; then
echo "Error: No Java process found." >&2
exit 1
fi
jcmd $process_id Thread.print > "$location/trace-${HOSTNAME}.log"
echo "Thread dump recorded successfully at $location." |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
| set -o nounset | ||
| set -o noglob | ||
|
|
||
| location=/appsmith-stacks/heap_dumps/ad-hoc/$(date "+%Y_%m_%d_%H_%S")/thread-profile; | ||
| mkdir -p $location; | ||
| jcmd $(pgrep -f -- "-jar\sserver.jar") JFR.start name=profile filename=$location/profile-${HOSTNAME}.jfr |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -o errexit | ||
| set -o pipefail | ||
| set -o nounset | ||
| set -o noglob | ||
|
Comment on lines
+1
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider enhancing error handling and logging. While the script is set to fail on errors with #!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
set -o noglob
process_id=$(pgrep -f -- "-jar\sserver.jar" || echo "")
if [ -z "$process_id" ]; then
echo "Error: No Java process found." >&2
exit 1
fi
jcmd $process_id JFR.dump name=profile
echo "JFR profile dumped successfully." |
||
|
|
||
| jcmd $(pgrep -f -- "-jar\sserver.jar") JFR.dump name=profile | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance error handling and directory creation checks.
While the script is functional, adding checks for directory creation and process identification can improve robustness. Consider logging actions for better traceability.