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

AMLII-1148 - Adding Unit test to check GC metrics emitted by each type of Java garbage collector #500

Merged
merged 24 commits into from
Dec 22, 2023

Conversation

carlosroman
Copy link
Contributor

@carlosroman carlosroman commented Dec 14, 2023

Also added tests for GC metrics.

Copy link
Contributor

@scottopell scottopell left a comment

Choose a reason for hiding this comment

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

I like this direction, if we can refactor the existing tests to use this new util that'd be great

}

@Override
public void start() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this wrapper, good idea to wrap this up a bit more.

@carlosroman carlosroman changed the title Added ability to change the final Docker image for misbehaving-jmx-se… Added ability to change the final Docker image for misbehaving-jmx-server Dec 20, 2023
@carlosroman carlosroman marked this pull request as ready for review December 20, 2023 18:08
@carlosroman carlosroman requested a review from a team as a code owner December 20, 2023 18:08
public void testDefaultOldGC() throws IOException {
try (final MisbehavingJMXServer server = new MisbehavingJMXServer(MisbehavingJMXServer.DEFAULT_RMI_PORT, MisbehavingJMXServer.DEFAULT_CONTROL_PORT,
MisbehavingJMXServer.DEFAULT_SUPERVISOR_PORT)) {
final List<Map<String, Object>> actualMetrics = startAngGetMetrics(server, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
final List<Map<String, Object>> actualMetrics = startAngGetMetrics(server, false);
final List<Map<String, Object>> actualMetrics = startAndGetMetrics(server, false);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix 🤦🏽‍♂️

public void testDefaultNewGCMetricsUseParallelGC() throws IOException {
try (final MisbehavingJMXServer server = new MisbehavingJMXServer(
MisbehavingJMXServer.JDK_11,
"-XX:+UseParallelGC -Xmx128M -Xms128M")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If all of these need increased heap mem, maybe that should be the default?

actualMetrics);
}

private static void assertGCMetric(final List<Map<String, Object>> actualMetrics,
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be implemented in terms of the above assertGCMetric? It looks like most of the tests use the above version


@Test
public void testJMXDirectBasic() throws Exception {
try (final SimpleAppContainer container = new SimpleAppContainer()){
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there any specific reason why you decided to leave in SimpleApp in addition to misbehaving-jmx-server?

tools/misbehaving-jmx-server/Dockerfile Show resolved Hide resolved
tools/misbehaving-jmx-server/Dockerfile Show resolved Hide resolved
@@ -123,12 +122,16 @@ static void stopJMXServer() throws IOException, InterruptedException {
}

static void startJMXServer() throws IOException {
ProcessBuilder pb = new ProcessBuilder("java",
final String misbehavingOpts = System.getenv("MISBEHAVING_OPTS");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add something to the docs about this var and what format it should have?


echo "Using `java --version`"
echo "With JAVA_OPTS '${JAVA_OPTS}'"
CONTAINER_IP=`awk 'END{print $1}' /etc/hosts`
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL awk keeps the last line's vars around for access in END https://www.gnu.org/software/gawk/manual/html_node/I_002fO-And-BEGIN_002fEND.html

@carlosroman carlosroman requested a review from a team as a code owner December 21, 2023 13:09
Copy link
Contributor

@drichards-87 drichards-87 left a comment

Choose a reason for hiding this comment

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

Left a small suggestion from Docs and approved the PR.

tools/misbehaving-jmx-server/README.md Outdated Show resolved Hide resolved
carlosroman and others added 2 commits December 21, 2023 15:55
Co-authored-by: DeForest Richards <56796055+drichards-87@users.noreply.github.com>
Copy link
Contributor

@scottopell scottopell left a comment

Choose a reason for hiding this comment

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

Discussed remaining items in-person. One or two comments/follow up cards to create, but otherwise we're good to go here

@carlosroman carlosroman changed the title Added ability to change the final Docker image for misbehaving-jmx-server AMLII-1148 - Adding Unit test to check GC metrics emitted by each type of Java garbage collector Dec 22, 2023
@carlosroman carlosroman merged commit 5b7b838 into master Dec 22, 2023
9 checks passed
@carlosroman carlosroman deleted the carlosroman/jvm-gc-tests branch December 22, 2023 12:25
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.

3 participants