This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 2c8c02f911 Fixed Metrics ITs that were failing due to recent changes (#5304) 2c8c02f911 is described below commit 2c8c02f911e6dcc1ffa961532596a514769064e0 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Wed Feb 5 07:48:59 2025 -0500 Fixed Metrics ITs that were failing due to recent changes (#5304) --- .../accumulo/test/functional/IdleProcessMetricsIT.java | 18 +++++++++++------- .../org/apache/accumulo/test/metrics/MetricsIT.java | 11 ++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java index 60896116bf..40be853e10 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java @@ -19,6 +19,8 @@ package org.apache.accumulo.test.functional; import static org.apache.accumulo.core.metrics.Metric.SERVER_IDLE; +import static org.apache.accumulo.core.metrics.MetricsInfo.PROCESS_NAME_TAG_KEY; +import static org.apache.accumulo.core.metrics.MetricsInfo.RESOURCE_GROUP_TAG_KEY; import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP1; import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.MAX_DATA; import static org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.compact; @@ -40,6 +42,7 @@ import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ScannerBase; +import org.apache.accumulo.core.client.admin.servers.ServerId; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.iterators.IteratorUtil; import org.apache.accumulo.core.security.Authorizations; @@ -152,16 +155,17 @@ public class IdleProcessMetricsIT extends SharedMiniClusterBase { List<String> statsDMetrics = sink.getLines(); statsDMetrics.stream().filter(line -> line.startsWith(SERVER_IDLE.getName())).peek(log::info) .map(TestStatsDSink::parseStatsDMetric) - .filter(a -> a.getTags().get("resource.group").equals(IDLE_RESOURCE_GROUP)).forEach(a -> { - String processName = a.getTags().get("process.name"); + .filter(a -> a.getTags().get(RESOURCE_GROUP_TAG_KEY).equals(IDLE_RESOURCE_GROUP)) + .forEach(a -> { + String processName = a.getTags().get(PROCESS_NAME_TAG_KEY); int value = Integer.parseInt(a.getValue()); assertTrue(value == 0 || value == 1 || value == -1, "Unexpected value " + value); // check that the idle metric was emitted for each - if ("tserver".equals(processName) && value == 1) { + if (ServerId.Type.TABLET_SERVER.name().equals(processName) && value == 1) { sawTServer.set(true); - } else if ("sserver".equals(processName) && value == 1) { + } else if (ServerId.Type.SCAN_SERVER.name().equals(processName) && value == 1) { sawSServer.set(true); - } else if ("compactor".equals(processName) && value == 1) { + } else if (ServerId.Type.COMPACTOR.name().equals(processName) && value == 1) { sawCompactor.set(true); } @@ -185,7 +189,7 @@ public class IdleProcessMetricsIT extends SharedMiniClusterBase { // should emit the idle metric after the configured duration of GENERAL_IDLE_PROCESS_INTERVAL Thread.sleep(idleProcessInterval.toMillis()); - final String processName = "compactor"; + final String processName = ServerId.Type.COMPACTOR.name(); log.info("Waiting for compactor to go idle"); waitForIdleMetricValueToBe(1, processName); @@ -227,7 +231,7 @@ public class IdleProcessMetricsIT extends SharedMiniClusterBase { // should emit the idle metric after the configured duration of GENERAL_IDLE_PROCESS_INTERVAL Thread.sleep(idleProcessInterval.toMillis()); - final String processName = "sserver"; + final String processName = ServerId.Type.SCAN_SERVER.name(); log.info("Waiting for sserver to go idle"); waitForIdleMetricValueToBe(1, processName); diff --git a/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java b/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java index f7dc6ff108..742f0ccade 100644 --- a/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/metrics/MetricsIT.java @@ -60,6 +60,7 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.fate.FateInstanceType; import org.apache.accumulo.core.fate.ReadOnlyFateStore.TStatus; import org.apache.accumulo.core.metrics.Metric; +import org.apache.accumulo.core.metrics.MetricsInfo; import org.apache.accumulo.core.metrics.MetricsProducer; import org.apache.accumulo.core.spi.metrics.LoggingMeterRegistryFactory; import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl; @@ -179,7 +180,7 @@ public class MetricsIT extends ConfigurableMacBase implements MetricsProducer { } else if (flakyMetrics.contains(metric)) { // ignore any flaky metric names seen // these aren't always expected, but we shouldn't be surprised if we see them - } else if (metric.getName().startsWith("accumulo.compactor.")) { + } else if (metric.getName().startsWith("accumulo.compaction.")) { // Compactor queue metrics are not guaranteed to be emitted // during the call to doWorkToGenerateMetrics above. This will // flip a bit in the BitSet when each metric is seen. The top-level @@ -289,13 +290,13 @@ public class MetricsIT extends ConfigurableMacBase implements MetricsProducer { log.info("METRICS, received from statsd - name: '{}' num tags: {}, tags: {} = {}", a.getName(), t.size(), t, a.getValue()); // check hostname is always set and is valid - assertNotEquals("0.0.0.0", a.getTags().get("host")); - assertNotNull(a.getTags().get("instance.name")); + assertNotEquals("0.0.0.0", a.getTags().get(MetricsInfo.HOST_TAG_KEY)); + assertNotNull(a.getTags().get(MetricsInfo.INSTANCE_NAME_TAG_KEY)); - assertNotNull(a.getTags().get("process.name")); + assertNotNull(a.getTags().get(MetricsInfo.PROCESS_NAME_TAG_KEY)); // check resource.group tag exists - assertNotNull(a.getTags().get("resource.group")); + assertNotNull(a.getTags().get(MetricsInfo.RESOURCE_GROUP_TAG_KEY)); // check that the user tags are present assertEquals("value1", a.getTags().get("tag1"));