-
Notifications
You must be signed in to change notification settings - Fork 13
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
plugin enhancement #24
Conversation
…ation(r/w access) support, container-dir to store dump and local-dir to save dump copy
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.
Thank you very much for this Pull-Request and the additional features it introduces.
I have made some comments. Please make sure to:
- use
gofmt
for code formatting - remove all unnecessary comments
- remove
.DS_Store
from the PR (you can add it to the.gitignore
) - add unit tests for
cfutils.go
- check out other comments I made in the PR
cf_cli_java_plugin.go
Outdated
@@ -168,10 +177,23 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator | |||
} | |||
|
|||
var remoteCommandTokens = []string{JavaDetectionCommand} | |||
|
|||
remoteFileFullPath := "" | |||
localFileFullPath:= "" |
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.
It looks like the code wasn't formatted with a code formatter. Can you please apply gofmt
?
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.
formatted
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
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.
I've added some more comments to go through.
In general, we're missing to test the whole utils/cfutils.go
. However, since I know that you're currently assigned with limited time, we can take this as a follow up improvement.
Before approving I'd like to quickly try out this build of the cf plugin myself with a demo Java app. I just saw that we have never added to the README how one can test the plugin locally. Can you maybe share how you've tested the plugin so that I do the test myself?
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
part 1, required tools presentjava-app: spring-music test case 1 - without any parameters set:command: cf java heap-dump spring-music test case 2 - with parameter keep set:command: cf java heap-dump spring-music -k test case 3 - with invalid container dir set:command: cf java heap-dump spring-music -container-dir /var/notexists test case 4 - with valid container dir set:command: cf java heap-dump spring-music -container-dir /var/fsjavadev test case 5 - with valid container dir and keep set:command: cf java heap-dump spring-music -container-dir /var/fsjavadev -keep test case 6 - with valid container dir and local-dir set:command: cf java heap-dump spring-music -container-dir /tmp -local-dir /Users/i318048 test case 7 - with valid container dir and invalid local-dir set:command: cf java heap-dump spring-music -container-dir /tmp -local-dir /Users/invalid test case 8 - with local-dir set:command: cf java heap-dump spring-music -local-dir /Users/i318048 part 2, required tools not ready:java-app: firstappzw test case 1: ssh disabledcommand: cf java heap-dump firstappzw -k test case 2: jvmmon and jmap missing(currently remove these two tools from container):command: cf java heap-dump firstappzw -k test case 3: with valid container dir and local dir set:command: cf java heap-dump firstappzw -container-dir /tmp -local-dir /Users/i318048 test case 4: with valid local dir set:command: cf java heap-dump firstappzw -local-dir /Users/i318048 |
@@ -0,0 +1,29 @@ | |||
module cf.plugin.ref/requires |
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.
I think this is still a copy paste error, isn't it? I think this should be something like:
module github.com/SAP/cf-cli-java-plugin
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.
its generated by go mod init
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.
I see. According to the go mod documentation, however, this should be set to the source code repository:
The module path should be a path from which Go tools can download the module source. In practice, this is typically the module source's repository domain and path to the module code within the repository. The go command relies on this form when downloading module versions to resolve dependencies on the module user's behalf.
Even if you're not at first intending to make your module available for use from other code, using its repository path is a best practice that will help you avoid having to rename the module if you publish it later.
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.
Can you please also test this with the sap_java_buildpack
? I tried to test it and it didn't work as per my comment.
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.
I think we're almost done. Only few minor things left before we can merge it.
The plugin will significantly benefit from your valuable contribution, it's pretty cool to use it with the new options :)
Thank you for your ongoing support and patience with my slow reviews.
Please note that I will be on vacation until August 25 and will look at the PR again after my return.
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
Co-authored-by: Tim Gerlach <Tim.Gerlach@sap.com>
Hi Tim,
When I tried modify it to like ‘module github.com/SAP/cf-cli-java-plugin’, compile will fail with error below:
go: updates to go.mod needed; to update it:
go mod tidy
make: *** [compile] Error 1
Regards,
Wei
From: Tim Gerlach ***@***.***>
Reply-To: SAP/cf-cli-java-plugin ***@***.***>
Date: Friday, August 13, 2021 at 9:27 PM
To: SAP/cf-cli-java-plugin ***@***.***>
Cc: "Zhou, Wei" ***@***.***>, Author ***@***.***>
Subject: Re: [SAP/cf-cli-java-plugin] plugin enhancement (#24)
@TimGerlach commented on this pull request.
________________________________
In go.mod<#24 (comment)>:
@@ -0,0 +1,29 @@
+module cf.plugin.ref/requires
I see. According to the go mod documentation<https://golang.org/doc/modules/gomod-ref#module-syntax>, however, this should be set to the source code repository:
The module path should be a path from which Go tools can download the module source. In practice, this is typically the module source's repository domain and path to the module code within the repository. The go command relies on this form when downloading module versions to resolve dependencies on the module user's behalf.
Even if you're not at first intending to make your module available for use from other code, using its repository path is a best practice that will help you avoid having to rename the module if you publish it later.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#24 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVAOAUK5GJ3ELFCKDSOEBM3T4UMRZANCNFSM5BGOYJQA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>.
|
Hi Wei, I have tried to change the module name locally to:
and ran |
I just went through the test cases and it all looked fine for both buildpacks (java, sap_java_buildpack) except for one scenario. $ cf java heap-dump spring-music
successfully created heap dump in application container at: ./app/java_pid7_3.hprof
heap dump will not be copied as parameter `local-dir` was not set
heap dump filed deleted in app container
Based on your code I expected the plugin to automatically detect the file system service file path and create the heap dump at Even when setting the container path explicitly, it's ignored: $ cf java heap-dump spring-music -container-dir /var/fsjavadev/timtest
successfully created heap dump in application container at: ./app/java_pid7_4.hprof
heap dump will not be copied as parameter `local-dir` was not set
heap dump filed deleted in app container Edit: I had another look at our code and it seems that we don't pass a path argument to jvmmon yet. I have not found this option in the manual of jvmmon so I have raised a question to the SAP JVM team to find out if it's possible to create a heap dump at a configurable path with jvmmon at all. Alternatively, we need to try whether According to the SAP JVM help:
|
Set cf env JAVA_OPTS as -XX:HeapDumpPath=/var/fsjavadev -XX:HeapDumpOnDemandPath=/tmp Oliver's suggestion works,
run jvmmon without specify any command, then change command line flag with interactive way.
Tried set -XX: HeapDumpPath in cf env and restage the app, doesn't work. |
file system service path enabled to save heap dump file;
error message given when required tools not present;
container path and local path to save dump file