-
Notifications
You must be signed in to change notification settings - Fork 70
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
Conversation
aca6d7d
to
0d94021
Compare
0d94021
to
ba48c6d
Compare
src/test/java/org/datadog/jmxfetch/util/MisbehavingJMXServer.java
Outdated
Show resolved
Hide resolved
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 like this direction, if we can refactor the existing tests to use this new util that'd be great
} | ||
|
||
@Override | ||
public void start() { |
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 like this wrapper, good idea to wrap this up a bit more.
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); |
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.
final List<Map<String, Object>> actualMetrics = startAngGetMetrics(server, false); | |
final List<Map<String, Object>> actualMetrics = startAndGetMetrics(server, false); |
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.
Will fix 🤦🏽♂️
public void testDefaultNewGCMetricsUseParallelGC() throws IOException { | ||
try (final MisbehavingJMXServer server = new MisbehavingJMXServer( | ||
MisbehavingJMXServer.JDK_11, | ||
"-XX:+UseParallelGC -Xmx128M -Xms128M")) { |
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.
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, |
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 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()){ |
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.
Was there any specific reason why you decided to leave in SimpleApp
in addition to misbehaving-jmx-server?
@@ -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"); |
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 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` |
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.
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
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.
Left a small suggestion from Docs and approved the PR.
Co-authored-by: DeForest Richards <[email protected]>
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.
Discussed remaining items in-person. One or two comments/follow up cards to create, but otherwise we're good to go here
Also added tests for GC metrics.