-
Notifications
You must be signed in to change notification settings - Fork 129
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
add wildfly.yaml to JMX scraper #1531
base: main
Are you sure you want to change the base?
Conversation
…ontrib into jmx-wildfly
@@ -25,11 +25,12 @@ protected GenericContainer<?> createTargetContainer(int jmxPort) { | |||
builder -> builder.from("apache/activemq-classic:5.18.6").build())) | |||
.withEnv("JAVA_TOOL_OPTIONS", genericJmxJvmArguments(jmxPort)) | |||
.withStartupTimeout(Duration.ofMinutes(2)) | |||
.waitingFor(Wait.forListeningPort()); | |||
.waitingFor(Wait.forLogMessage(".*Apache ActiveMQ.*started.*", 1)); |
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.
[for reviewer] waiting for open port seems to sometimes not be accurate enough to detect proper startup, which makes the scraper container start when the JMX port is not yet available. Waiting on log message is an attempt to make this a bit less flaky (time will tell if that's a good idea or not here).
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.
Wait.forListeningPort() requires withExposedPorts(jmxPort) to be called to work properly. I think Tomcat test works by a chance. I added withExposedPorts to all tests using forListeningPort on my branch, but you can add it in your PR instead
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.
While this sounds brittle, I think it's slightly better to wait for the target application to be properly started (here we use the log message as a proxy), because while the JMX port might be open early, the MBeans are likely not yet published so while we can connect to it the MBeans that we are trying to access are likely not yet published.
Otherwise do you suggest to add to every container something like this for Tomcat:
protected GenericContainer<?> createTargetContainer(int jmxPort) {
return new GenericContainer<>(
new ImageFromDockerfile()
// ...
.withStartupTimeout(Duration.ofMinutes(2))
.withExposedPorts(8080, jmxPort)
.waitingFor(Wait.forListeningPorts(8080, jmxPort));
}
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.
As discussed today I've implemented it for all other containers in 3ab2f28.
Description:
jboss-client.jar
for using HTTP management APIwildfly.groovy
to fit the stable convention for metric units.Part of #1362
Notes:
In the original groovy implementation session metrics are not tested, this requires deploying and application to the container, this is not properly tested in the YAML implementation.
In the original groovy implementation the gatherer was run directly from the same docker container probably for simplicity as
jboss-client.jar
is directly available.When using two containers, the jar needs to be copied from wildfly container to scraper container and it complicates authentication: login/pwd can be skipped if both processes run on the same host and can access the same filesystem.
Testing here is done using two distinct containers as this setup is a bit more complex and thus likely to fail (doing so here helped me find that we did not handle it properly).