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

jmx scraper connection test #1684

Merged
merged 10 commits into from
Feb 10, 2025
Merged

Conversation

SylvainJuge
Copy link
Contributor

Relates to #1681

This PR adds a new CLI argument to enable end-users to test JMX connection.

JMX connection is expected to be tedious to setup and will benefit from a fast feedback loop as there are multiple things that can be problematic during setup:

  • authentication credentials
  • client and server SSL certificates
  • SSL enabled on RMI registry
  • ...

Also, testing connection through this mean allow us to validate configuration usage with CLI interface and avoids having any complication due to JMX/RMI port mapping which is not NAT friendly (open connection on a port, then another one is used afterwards).

}
}

private static void checkConnectionLogs(JmxScraperContainer scraper, boolean expectedOk) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] we have to parse and check scraper logs in order to know if the connection is OK or not, this is because we can't access the process exit value when the program completes.

*/
@CanIgnoreReturnValue
public TestAppContainer withHostAccessFixedJmxPort(int port) {
// To get host->container JMX connection working docker must expose JMX/RMI port under the same
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] this is no longer necessary as we only rely on container-to-container communication and we don't have to use docker NAT to access the JMX endpoint.

import org.junit.jupiter.api.Test;
import org.testcontainers.containers.Network;

public class JmxConnectorBuilderTest {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] this is replaced by JmxConnectionTest.

@SylvainJuge SylvainJuge marked this pull request as ready for review February 3, 2025 15:32
@SylvainJuge SylvainJuge requested a review from a team as a code owner February 3, 2025 15:32
@trask trask merged commit 4ed5a14 into open-telemetry:main Feb 10, 2025
18 checks passed
breedx-splk pushed a commit to breedx-splk/opentelemetry-java-contrib that referenced this pull request Feb 14, 2025
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.

4 participants