This is an automated email from the ASF dual-hosted git repository.

domgarguilo 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 16b71cd094 Use Metric.getDescription() for all micrometer instruments 
(#4925)
16b71cd094 is described below

commit 16b71cd094bb6ea39a7d5c2cddc890bad9f0c3ef
Author: Dom G. <domgargu...@apache.org>
AuthorDate: Tue Oct 8 09:28:32 2024 -0400

    Use Metric.getDescription() for all micrometer instruments (#4925)
    
    * Use Metric.getDescription() for all micrometer instruments
    * Fill in empty Metric descriptions
---
 .../org/apache/accumulo/core/metrics/Metric.java   | 24 +++++++++++++---------
 .../coordinator/CompactionCoordinator.java         |  8 ++++----
 .../compaction/coordinator/QueueMetrics.java       | 22 ++++++++++----------
 .../accumulo/manager/metrics/ManagerMetrics.java   | 16 ++++++++++-----
 .../manager/metrics/fate/meta/MetaFateMetrics.java | 10 ++++-----
 5 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/metrics/Metric.java 
b/core/src/main/java/org/apache/accumulo/core/metrics/Metric.java
index f096b96a94..92690123c6 100644
--- a/core/src/main/java/org/apache/accumulo/core/metrics/Metric.java
+++ b/core/src/main/java/org/apache/accumulo/core/metrics/Metric.java
@@ -41,16 +41,16 @@ public enum Metric {
       MetricCategory.COMPACTOR),
   COMPACTOR_JOB_PRIORITY_QUEUES("accumulo.compactor.queue.count", 
MetricType.GAUGE,
       "Number of priority queues for compaction jobs.", 
MetricCategory.COMPACTOR),
-  COMPACTOR_JOB_PRIORITY_QUEUE_LENGTH("accumulo.compactor.queue.length", 
MetricType.GAUGE, "",
-      MetricCategory.COMPACTOR),
+  COMPACTOR_JOB_PRIORITY_QUEUE_LENGTH("accumulo.compactor.queue.length", 
MetricType.GAUGE,
+      "Length of priority queue.", MetricCategory.COMPACTOR),
   
COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_DEQUEUED("accumulo.compactor.queue.jobs.dequeued",
-      MetricType.GAUGE, "", MetricCategory.COMPACTOR),
+      MetricType.GAUGE, "Count of dequeued jobs.", MetricCategory.COMPACTOR),
   
COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_QUEUED("accumulo.compactor.queue.jobs.queued",
 MetricType.GAUGE,
-      "", MetricCategory.COMPACTOR),
+      "Count of queued jobs.", MetricCategory.COMPACTOR),
   
COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_REJECTED("accumulo.compactor.queue.jobs.rejected",
-      MetricType.GAUGE, "", MetricCategory.COMPACTOR),
+      MetricType.GAUGE, "Count of rejected jobs.", MetricCategory.COMPACTOR),
   
COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_PRIORITY("accumulo.compactor.queue.jobs.priority",
-      MetricType.GAUGE, "", MetricCategory.COMPACTOR),
+      MetricType.GAUGE, "Lowest priority queued job.", 
MetricCategory.COMPACTOR),
 
   // Fate Metrics
   FATE_TYPE_IN_PROGRESS("accumulo.fate.ops.in.progress.by.type", 
MetricType.GAUGE,
@@ -243,14 +243,18 @@ public enum Metric {
       MetricType.GAUGE,
       "The number of migrations that need to complete before the system is 
balanced.",
       MetricCategory.MANAGER),
-  MANAGER_ROOT_TGW_ERRORS("accumulo.manager.tabletmgmt.root.errors", 
MetricType.GAUGE, "",
+  MANAGER_ROOT_TGW_ERRORS("accumulo.manager.tabletmgmt.root.errors", 
MetricType.GAUGE,
+      "Error count encountered by the TabletGroupWatcher for the ROOT data 
level.",
       MetricCategory.MANAGER),
-  MANAGER_META_TGW_ERRORS("accumulo.manager.tabletmgmt.meta.errors", 
MetricType.GAUGE, "",
+  MANAGER_META_TGW_ERRORS("accumulo.manager.tabletmgmt.meta.errors", 
MetricType.GAUGE,
+      "Error count encountered by the TabletGroupWatcher for the META data 
level.",
       MetricCategory.MANAGER),
-  MANAGER_USER_TGW_ERRORS("accumulo.manager.tabletmgmt.user.errors", 
MetricType.GAUGE, "",
+  MANAGER_USER_TGW_ERRORS("accumulo.manager.tabletmgmt.user.errors", 
MetricType.GAUGE,
+      "Error count encountered by the TabletGroupWatcher for the USER data 
level.",
       MetricCategory.MANAGER),
   
MANAGER_COMPACTION_SVC_ERRORS("accumulo.manager.compaction.svc.misconfigured", 
MetricType.GAUGE,
-      "", MetricCategory.MANAGER);
+      "A value of 1 indicates a misconfiguration in the compaction service, 
while a value of 0 indicates that the configuration is valid.",
+      MetricCategory.MANAGER);
 
   private final String name;
   private final MetricType type;
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
index 3dae538065..c4d9429866 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/CompactionCoordinator.java
@@ -647,11 +647,11 @@ public class CompactionCoordinator
   @Override
   public void registerMetrics(MeterRegistry registry) {
     Gauge.builder(MAJC_QUEUED.getName(), jobQueues, 
CompactionJobQueues::getQueuedJobCount)
-        .tag("subprocess", "compaction.coordinator")
-        .description("Number of queued major compactions").register(registry);
+        .tag("subprocess", 
"compaction.coordinator").description(MAJC_QUEUED.getDescription())
+        .register(registry);
     Gauge.builder(MAJC_RUNNING.getName(), this, 
CompactionCoordinator::getNumRunningCompactions)
-        .tag("subprocess", "compaction.coordinator")
-        .description("Number of running major compactions").register(registry);
+        .tag("subprocess", 
"compaction.coordinator").description(MAJC_RUNNING.getDescription())
+        .register(registry);
 
     queueMetrics.registerMetrics(registry);
   }
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java
index dbc4300f42..eb2b9800c2 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java
@@ -64,32 +64,32 @@ public class QueueMetrics implements MetricsProducer {
 
       length =
           Gauge.builder(COMPACTOR_JOB_PRIORITY_QUEUE_LENGTH.getName(), queue, 
q -> q.getMaxSize())
-              .description("Length of priority 
queues").tags(List.of(Tag.of("queue.id", queueId)))
-              .register(meterRegistry);
+              
.description(COMPACTOR_JOB_PRIORITY_QUEUE_LENGTH.getDescription())
+              .tags(List.of(Tag.of("queue.id", 
queueId))).register(meterRegistry);
 
       jobsQueued = Gauge
           .builder(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_QUEUED.getName(), queue,
               q -> q.getQueuedJobs())
-          .description("Count of queued jobs").tags(List.of(Tag.of("queue.id", 
queueId)))
-          .register(meterRegistry);
+          
.description(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_QUEUED.getDescription())
+          .tags(List.of(Tag.of("queue.id", queueId))).register(meterRegistry);
 
       jobsDequeued = Gauge
           .builder(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_DEQUEUED.getName(), queue,
               q -> q.getDequeuedJobs())
-          .description("Count of jobs 
dequeued").tags(List.of(Tag.of("queue.id", queueId)))
-          .register(meterRegistry);
+          
.description(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_DEQUEUED.getDescription())
+          .tags(List.of(Tag.of("queue.id", queueId))).register(meterRegistry);
 
       jobsRejected = Gauge
           .builder(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_REJECTED.getName(), queue,
               q -> q.getRejectedJobs())
-          .description("Count of rejected 
jobs").tags(List.of(Tag.of("queue.id", queueId)))
-          .register(meterRegistry);
+          
.description(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_REJECTED.getDescription())
+          .tags(List.of(Tag.of("queue.id", queueId))).register(meterRegistry);
 
       jobsLowestPriority = Gauge
           .builder(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_PRIORITY.getName(), queue,
               q -> q.getLowestPriority())
-          .description("Lowest priority queued 
job").tags(List.of(Tag.of("queue.id", queueId)))
-          .register(meterRegistry);
+          
.description(COMPACTOR_JOB_PRIORITY_QUEUE_JOBS_PRIORITY.getDescription())
+          .tags(List.of(Tag.of("queue.id", queueId))).register(meterRegistry);
     }
 
     private void removeMeters(MeterRegistry registry) {
@@ -126,7 +126,7 @@ public class QueueMetrics implements MetricsProducer {
       queueCountMeter = Gauge
           .builder(COMPACTOR_JOB_PRIORITY_QUEUES.getName(), 
compactionJobQueues,
               CompactionJobQueues::getQueueCount)
-          .description("Number of current Queues").register(localRegistry);
+          
.description(COMPACTOR_JOB_PRIORITY_QUEUES.getDescription()).register(localRegistry);
     }
     LOG.debug("update - cjq queues: {}", compactionJobQueues.getQueueIds());
 
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/metrics/ManagerMetrics.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/metrics/ManagerMetrics.java
index 40f8a6d262..356e8429fa 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/metrics/ManagerMetrics.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/metrics/ManagerMetrics.java
@@ -38,6 +38,7 @@ import org.apache.accumulo.manager.metrics.fate.FateMetrics;
 import org.apache.accumulo.manager.metrics.fate.meta.MetaFateMetrics;
 import org.apache.accumulo.manager.metrics.fate.user.UserFateMetrics;
 
+import io.micrometer.core.instrument.Gauge;
 import io.micrometer.core.instrument.MeterRegistry;
 
 public class ManagerMetrics implements MetricsProducer {
@@ -86,11 +87,16 @@ public class ManagerMetrics implements MetricsProducer {
   @Override
   public void registerMetrics(MeterRegistry registry) {
     fateMetrics.forEach(fm -> fm.registerMetrics(registry));
-    registry.gauge(MANAGER_ROOT_TGW_ERRORS.getName(), rootTGWErrorsGauge);
-    registry.gauge(MANAGER_META_TGW_ERRORS.getName(), metadataTGWErrorsGauge);
-    registry.gauge(MANAGER_USER_TGW_ERRORS.getName(), userTGWErrorsGauge);
-    registry.gauge(MANAGER_COMPACTION_SVC_ERRORS.getName(), 
compactionConfigurationError,
-        AtomicInteger::get);
+    Gauge.builder(MANAGER_ROOT_TGW_ERRORS.getName(), rootTGWErrorsGauge, 
AtomicLong::get)
+        
.description(MANAGER_ROOT_TGW_ERRORS.getDescription()).register(registry);
+    Gauge.builder(MANAGER_META_TGW_ERRORS.getName(), metadataTGWErrorsGauge, 
AtomicLong::get)
+        
.description(MANAGER_META_TGW_ERRORS.getDescription()).register(registry);
+    Gauge.builder(MANAGER_USER_TGW_ERRORS.getName(), userTGWErrorsGauge, 
AtomicLong::get)
+        
.description(MANAGER_USER_TGW_ERRORS.getDescription()).register(registry);
+    Gauge
+        .builder(MANAGER_COMPACTION_SVC_ERRORS.getName(), 
compactionConfigurationError,
+            AtomicInteger::get)
+        
.description(MANAGER_COMPACTION_SVC_ERRORS.getDescription()).register(registry);
   }
 
   public List<MetricsProducer> getProducers(AccumuloConfiguration conf, 
Manager manager) {
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/metrics/fate/meta/MetaFateMetrics.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/metrics/fate/meta/MetaFateMetrics.java
index 02aa3a28f4..d26cf259d9 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/metrics/fate/meta/MetaFateMetrics.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/metrics/fate/meta/MetaFateMetrics.java
@@ -21,7 +21,6 @@ package org.apache.accumulo.manager.metrics.fate.meta;
 import static org.apache.accumulo.core.metrics.Metric.FATE_ERRORS;
 import static org.apache.accumulo.core.metrics.Metric.FATE_OPS_ACTIVITY;
 
-import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.accumulo.core.Constants;
@@ -32,8 +31,8 @@ import org.apache.accumulo.manager.metrics.fate.FateMetrics;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.zookeeper.KeeperException;
 
+import io.micrometer.core.instrument.Gauge;
 import io.micrometer.core.instrument.MeterRegistry;
-import io.micrometer.core.instrument.Tag;
 
 public class MetaFateMetrics extends FateMetrics<MetaFateMetricValues> {
 
@@ -56,9 +55,10 @@ public class MetaFateMetrics extends 
FateMetrics<MetaFateMetricValues> {
   @Override
   public void registerMetrics(MeterRegistry registry) {
     super.registerMetrics(registry);
-    registry.gauge(FATE_OPS_ACTIVITY.getName(), totalOpsGauge);
-    registry.gauge(FATE_ERRORS.getName(), List.of(Tag.of("type", 
"zk.connection")),
-        fateErrorsGauge);
+    Gauge.builder(FATE_OPS_ACTIVITY.getName(), totalOpsGauge, AtomicLong::get)
+        .description(FATE_OPS_ACTIVITY.getDescription()).register(registry);
+    Gauge.builder(FATE_ERRORS.getName(), fateErrorsGauge, AtomicLong::get)
+        .tag("type", 
"zk.connection").description(FATE_ERRORS.getDescription()).register(registry);
   }
 
   @Override

Reply via email to