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 ad99c33c78 Ensure Manager process metrics are emitted. (#6182)
ad99c33c78 is described below

commit ad99c33c78f343dac9fb1089c0e6ee6296301b47
Author: Dave Marion <[email protected]>
AuthorDate: Thu Mar 5 14:49:49 2026 -0500

    Ensure Manager process metrics are emitted. (#6182)
---
 .../java/org/apache/accumulo/manager/Manager.java  |  1 +
 ...ProcessMetricsIT.java => ProcessMetricsIT.java} | 47 +++++++++++++++++++---
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java 
b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
index 245ef6a21a..b50654a90b 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
@@ -1020,6 +1020,7 @@ public class Manager extends AbstractServer
 
     MetricsInfo metricsInfo = getContext().getMetricsInfo();
     List<MetricsProducer> producers = new ArrayList<>();
+    producers.add(this);
     producers.add(balanceManager.getMetrics());
 
     final TabletGroupWatcher userTableTGW =
diff --git 
a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
 b/test/src/main/java/org/apache/accumulo/test/functional/ProcessMetricsIT.java
similarity index 85%
rename from 
test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
rename to 
test/src/main/java/org/apache/accumulo/test/functional/ProcessMetricsIT.java
index 40be853e10..20846faf78 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/functional/IdleProcessMetricsIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/functional/ProcessMetricsIT.java
@@ -18,6 +18,7 @@
  */
 package org.apache.accumulo.test.functional;
 
+import static org.apache.accumulo.core.metrics.Metric.LOW_MEMORY;
 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;
@@ -61,15 +62,15 @@ import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class IdleProcessMetricsIT extends SharedMiniClusterBase {
+public class ProcessMetricsIT extends SharedMiniClusterBase {
 
-  private static final Logger log = 
LoggerFactory.getLogger(IdleProcessMetricsIT.class);
+  private static final Logger log = 
LoggerFactory.getLogger(ProcessMetricsIT.class);
 
   static final Duration idleProcessInterval = Duration.ofSeconds(10);
 
   public static final String IDLE_RESOURCE_GROUP = "IDLE_PROCESS_TEST";
 
-  public static class IdleStopITConfig implements 
MiniClusterConfigurationCallback {
+  public static class ProcessMetricsITConfig implements 
MiniClusterConfigurationCallback {
 
     @Override
     public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration 
coreSite) {
@@ -128,7 +129,7 @@ public class IdleProcessMetricsIT extends 
SharedMiniClusterBase {
   @BeforeAll
   public static void before() throws Exception {
     sink = new TestStatsDSink();
-    SharedMiniClusterBase.startMiniClusterWithConfig(new IdleStopITConfig());
+    SharedMiniClusterBase.startMiniClusterWithConfig(new 
ProcessMetricsITConfig());
   }
 
   @AfterAll
@@ -142,7 +143,7 @@ public class IdleProcessMetricsIT extends 
SharedMiniClusterBase {
    * tserver.
    */
   @Test
-  public void testIdleStopMetrics() throws Exception {
+  public void testIdleMetrics() throws Exception {
 
     // should emit the idle metric after the configured duration of 
GENERAL_IDLE_PROCESS_INTERVAL
     Thread.sleep(idleProcessInterval.toMillis());
@@ -174,6 +175,42 @@ public class IdleProcessMetricsIT extends 
SharedMiniClusterBase {
     });
   }
 
+  /**
+   * Test that the low mem process metrics are emitted by all processes
+   */
+  @Test
+  public void testLowMemMetrics() throws Exception {
+
+    // can't test Monitor, Mini doesn't start it
+    AtomicBoolean sawManager = new AtomicBoolean(false);
+    AtomicBoolean sawGC = new AtomicBoolean(false);
+    AtomicBoolean sawCompactor = new AtomicBoolean(false);
+    AtomicBoolean sawSServer = new AtomicBoolean(false);
+    AtomicBoolean sawTServer = new AtomicBoolean(false);
+
+    Wait.waitFor(() -> {
+      List<String> statsDMetrics = sink.getLines();
+      statsDMetrics.stream().filter(line -> 
line.startsWith(LOW_MEMORY.getName())).peek(log::info)
+          .map(TestStatsDSink::parseStatsDMetric).forEach(a -> {
+            String processName = a.getTags().get(PROCESS_NAME_TAG_KEY);
+            if (ServerId.Type.TABLET_SERVER.name().equals(processName)) {
+              sawTServer.set(true);
+            } else if (ServerId.Type.SCAN_SERVER.name().equals(processName)) {
+              sawSServer.set(true);
+            } else if (ServerId.Type.COMPACTOR.name().equals(processName)) {
+              sawCompactor.set(true);
+            } else if (ServerId.Type.MANAGER.name().equals(processName)) {
+              sawManager.set(true);
+            } else if 
(ServerId.Type.GARBAGE_COLLECTOR.name().equals(processName)) {
+              sawGC.set(true);
+            }
+
+          });
+      return sawManager.get() && sawGC.get() && sawCompactor.get() && 
sawSServer.get()
+          && sawTServer.get();
+    });
+  }
+
   /**
    * Test that before during and after a compaction, the compactor will emit 
the appropriate value
    * for the idle metric.

Reply via email to