Skip to content

Commit

Permalink
Fix flaky JVM Thread metrics test (#915)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Stäber <[email protected]>
  • Loading branch information
fstab authored Jan 22, 2024
1 parent b229888 commit bf6bc2c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ public void testIgnoredMetricNotScraped() {
@Test
public void testInvalidThreadIds() {
try {
int javaVersion = Integer.parseInt(System.getProperty("java.version"));
if (javaVersion >= 21) {
String javaVersion = System.getProperty("java.version"); // Example: "21.0.2"
String majorJavaVersion = javaVersion.replaceAll("\\..*", ""); // Example: "21"
if (Integer.parseInt(majorJavaVersion) >= 21) {
// With Java 21 and newer you can no longer have invalid thread ids.
return;
}
Expand Down

0 comments on commit bf6bc2c

Please sign in to comment.