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

jfr-connection: fixes for using diagnostic command to start a recording #1352

Merged
merged 5 commits into from
Jul 11, 2024

Conversation

dsgrieve
Copy link
Contributor

@dsgrieve dsgrieve commented Jun 26, 2024

Description:
Time based recording options (time and age) are sent with a space between the value and units, e.g. "6000 ms", which may cause an issue with Java 8/Diagnostic Command.

In the course of testing, I found an issue with the code that checks to see if -XX:+UnlockCommercialFeatures needs to be set. The issue was that this check was applied always and would erroneously report that the user needed to UnlockCommercialFeatures even though the JVM was not an Oracle JVM. I addressed this by putting an additional check to see if the VM vendor is "Oracle Corporation" and the VM version is 1.8, 9, or 10. Oracle removed UnlockCommercialFeatures in JDK 11.

Existing Issue(s):
Fixes #1338

Testing:
I tested locally with Oracle JVMs version 1.8, 11, 17 and 21, and also with Adoptium and Microsoft JVMs.
Modified existing unit tests to accept <value><units> as oppsed to <value> <units>
Added unit test that starts a recording for a specified duration where the duration configured in the RecordingOptions as 5s or 5 s. This test is run with both the diagnostic command connection and with the MBean connection to ensure there are no differences. This test does not use Mock as do others.

Documentation:
One place in the documentation had an example duration with a space between the value and units. I eliminated the space, although the code normalizes the string by eliminating any space.

Outstanding items:

< Anything that these changes are intentionally missing
that will be needed or can be helpful in the future. >

Copy link
Member

@jeanbisutti jeanbisutti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @dsgrieve!

@dsgrieve dsgrieve requested a review from jeanbisutti July 1, 2024 19:14
@dsgrieve
Copy link
Contributor Author

dsgrieve commented Jul 8, 2024

@breedx-splk - Waiting for your review.

@trask trask added this to the v1.37.0 milestone Jul 9, 2024
@trask trask merged commit 63361cc into open-telemetry:main Jul 11, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sending JFR RecordingOptions with a diagnostic command may fail on Java 8
4 participants