architjainjain commented on code in PR #6501:
URL: https://github.com/apache/hive/pull/6501#discussion_r3457178569


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/monitoring/TezProgressMonitor.java:
##########
@@ -327,6 +338,62 @@ public int hashCode() {
     }
   }
 
+  @Override
+  public String queueMetrics() {
+    if (metricsCollector == null) {
+      return "";
+    }
+
+    try {
+      YarnQueueMetricsCollector.QueueMetricsSnapshot snapshot = 
metricsCollector.getLatestSnapshot();
+      if (snapshot == null) {
+        return "QUEUE: unavailable";
+      }
+
+      // Calculate staleness
+      long stalenessSeconds = (System.currentTimeMillis() - 
snapshot.getCollectionTimestamp()) / 1000;
+      String stalenessStr = stalenessSeconds > 60 ? ">60s ago" : 
stalenessSeconds + "s ago";
+
+      // Truncate queue name from start if too long
+      String queueName = metricsCollector.getQueueName();
+      // Max length for line 1: 94 - "QUEUE:  (XXXs ago)".length()
+      String stalenessAppend = " (" + stalenessStr + ")";
+      int maxQueueNameLength = InPlaceUpdate.MIN_TERMINAL_WIDTH - "QUEUE: 
".length() - stalenessAppend.length();
+      String displayQueueName = queueName;
+      if (queueName.length() > maxQueueNameLength && maxQueueNameLength > 3) {
+        int keepLength = maxQueueNameLength - 3; // Leave room for "..."
+        displayQueueName = "..." + queueName.substring(queueName.length() - 
keepLength);
+      }

Review Comment:
   done



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to