DomGarguilo commented on code in PR #4924:
URL: https://github.com/apache/accumulo/pull/4924#discussion_r1775400616


##########
server/manager/src/main/java/org/apache/accumulo/manager/metrics/fate/FateMetrics.java:
##########
@@ -88,77 +83,50 @@ public FateMetrics(final ServerContext context, final long 
minimumRefreshDelay)
           "FATE Metrics - Interrupt received while initializing zoo store");
     }
 
+    for (TStatus status : TStatus.values()) {
+      txStatusCounters.put(status, new AtomicLong(0));
+    }
+
   }
 
   private void update() {
 
     FateMetricValues metricValues =
         FateMetricValues.getFromZooKeeper(context, fateRootPath, zooStore);
 
-    totalCurrentOpsGauge.set(metricValues.getCurrentFateOps());
-    totalOpsGauge.set(metricValues.getZkFateChildOpsTotal());
-    fateErrorsGauge.set(metricValues.getZkConnectionErrors());
-
-    for (Entry<String,Long> vals : 
metricValues.getTxStateCounters().entrySet()) {
-      switch (ReadOnlyTStore.TStatus.valueOf(vals.getKey())) {
-        case NEW:
-          newTxGauge.set(vals.getValue());
-          break;
-        case SUBMITTED:
-          submittedTxGauge.set(vals.getValue());
-          break;
-        case IN_PROGRESS:
-          inProgressTxGauge.set(vals.getValue());
-          break;
-        case FAILED_IN_PROGRESS:
-          failedInProgressTxGauge.set(vals.getValue());
-          break;
-        case FAILED:
-          failedTxGauge.set(vals.getValue());
-          break;
-        case SUCCESSFUL:
-          successfulTxGauge.set(vals.getValue());
-          break;
-        case UNKNOWN:
-          unknownTxGauge.set(vals.getValue());
-          break;
-        default:
-          log.warn("Unhandled status type: {}", vals.getKey());
+    totalCurrentOpsCount.set(metricValues.getCurrentFateOps());
+    totalOpsCount.set(metricValues.getZkFateChildOpsTotal());
+    fateErrorsCount.set(metricValues.getZkConnectionErrors());
+
+    for (Entry<TStatus,Long> entry : 
metricValues.getTxStateCounters().entrySet()) {
+      try {
+        AtomicLong counter = txStatusCounters.get(entry.getKey());
+        if (counter != null) {
+          counter.set(entry.getValue());
+        } else {
+          log.warn("Unhandled TStatus: {}", entry.getKey());
+        }
+      } catch (IllegalArgumentException e) {

Review Comment:
   Oh yea that can be removed. I think it was left in by accident from a change 
while I was developing this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to