diff --git a/muted-tests.yml b/muted-tests.yml index 75c7dc55f8a48..bbfb6a84179ec 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -258,24 +258,9 @@ tests: - class: org.elasticsearch.repositories.azure.AzureBlobContainerRetriesTests method: testWriteBlobWithRetries issue: https://github.com/elastic/elasticsearch/issues/144025 -- class: org.elasticsearch.test.apmintegration.MetricsApmIT - method: testJvmMetrics {withOTel=true} - issue: https://github.com/elastic/elasticsearch/issues/144166 -- class: org.elasticsearch.test.apmintegration.MetricsApmIT - method: testJvmMetrics {withOTel=false} - issue: https://github.com/elastic/elasticsearch/issues/144167 -- class: org.elasticsearch.test.apmintegration.MetricsApmIT - method: testApmIntegration {withOTel=false} - issue: https://github.com/elastic/elasticsearch/issues/144282 - class: org.elasticsearch.reindex.management.ReindexGetRelocationIT method: testGetReindexFollowsRelocation issue: https://github.com/elastic/elasticsearch/issues/144364 -- class: org.elasticsearch.server.cli.APMJvmOptionsTests - method: testAPMAgentMetricsDisabledWhenOtelMetricsEnabled - issue: https://github.com/elastic/elasticsearch/issues/144357 -- class: org.elasticsearch.server.cli.APMJvmOptionsTests - method: testAPMAgentAlwaysAttached - issue: https://github.com/elastic/elasticsearch/issues/144358 - class: org.elasticsearch.xpack.application.OpenAiServiceUpgradeIT method: testOpenAiEmbeddings {upgradedNodes=3} issue: https://github.com/elastic/elasticsearch/issues/144440 diff --git a/server/src/test/java/org/elasticsearch/monitor/metrics/SystemMetricsTests.java b/server/src/test/java/org/elasticsearch/monitor/metrics/SystemMetricsTests.java index a87fb90b615ed..7126cb1815abf 100644 --- a/server/src/test/java/org/elasticsearch/monitor/metrics/SystemMetricsTests.java +++ b/server/src/test/java/org/elasticsearch/monitor/metrics/SystemMetricsTests.java @@ -10,6 +10,7 @@ package org.elasticsearch.monitor.metrics; import org.elasticsearch.core.SuppressForbidden; +import org.elasticsearch.monitor.process.ProcessProbe; import org.elasticsearch.telemetry.InstrumentType; import org.elasticsearch.telemetry.RecordingMeterRegistry; import org.elasticsearch.test.ESTestCase; @@ -48,17 +49,19 @@ private static void testSystemMetrics(boolean emitOTelMetrics) { systemMetrics.start(); List registeredGauges = registry.getRecorder().getRegisteredMetrics(InstrumentType.LONG_GAUGE); - assertTrue("jvm.fd.used should always be registered", registeredGauges.contains("jvm.fd.used")); - assertTrue("jvm.fd.max should always be registered", registeredGauges.contains("jvm.fd.max")); + boolean openFdSupported = ProcessProbe.getOpenFileDescriptorCount() >= 0; + boolean maxFdSupported = ProcessProbe.getMaxFileDescriptorCount() >= 0; + assertEquals("jvm.fd.used should be registered if supported", openFdSupported, registeredGauges.contains("jvm.fd.used")); + assertEquals("jvm.fd.max should be registered if supported", maxFdSupported, registeredGauges.contains("jvm.fd.max")); assertEquals( "jvm.file_descriptor.count should be registered if emitting OTel metrics", - registeredGauges.contains("jvm.file_descriptor.count"), - emitOTelMetrics + openFdSupported && emitOTelMetrics, + registeredGauges.contains("jvm.file_descriptor.count") ); assertEquals( "jvm.file_descriptor.limit should be registered if emitting OTel metrics", - registeredGauges.contains("jvm.file_descriptor.limit"), - emitOTelMetrics + maxFdSupported && emitOTelMetrics, + registeredGauges.contains("jvm.file_descriptor.limit") ); } } diff --git a/test/external-modules/apm-integration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/AbstractMetricsIT.java b/test/external-modules/apm-integration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/AbstractMetricsIT.java index 7f44d655ff155..4d65a774d731f 100644 --- a/test/external-modules/apm-integration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/AbstractMetricsIT.java +++ b/test/external-modules/apm-integration/src/javaRestTest/java/org/elasticsearch/test/apmintegration/AbstractMetricsIT.java @@ -9,6 +9,7 @@ package org.elasticsearch.test.apmintegration; +import org.apache.lucene.util.Constants; import org.elasticsearch.client.Request; import org.elasticsearch.logging.LogManager; import org.elasticsearch.logging.Logger; @@ -179,6 +180,12 @@ public void testJvmMetrics() throws Exception { ) ); + if (Constants.WINDOWS) { + // JVM file descriptor metrics are not emitted on Windows. + valueAssertions.remove("jvm.fd.used"); + valueAssertions.remove("jvm.fd.max"); + } + CountDownLatch finished = new CountDownLatch(1); Consumer messageConsumer = (ReceivedTelemetry msg) -> {