PrachiKhobragade commented on code in PR #9977:
URL: https://github.com/apache/pinot/pull/9977#discussion_r1050185091


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -617,6 +624,28 @@ private boolean processStreamEvents(MessageBatch 
messagesAndOffsets, long idlePi
     return prematureExit;
   }
 
+  private void updateConsumerLagMetrics() {
+    boolean emitAvailabilityLag = true;
+    if (_caughtUpWithUpstream) {
+      Map<String, PartitionLagState> lagStateMap = 
getPartitionToLagState(getConsumerPartitionState(true));
+      for (Map.Entry<String, PartitionLagState> entry : 
lagStateMap.entrySet()) {
+        String partitionId = entry.getKey();
+        PartitionLagState lagState = entry.getValue();
+        if (emitAvailabilityLag && 
!PartitionLagState.NOT_CALCULATED.equals(lagState.getAvailabilityLagMs())) {
+          try {
+            _serverMetrics.setValueOfPartitionGauge(_tableNameWithType, 
Integer.parseInt(partitionId),
+                ServerGauge.LLC_AVAILABILITY_LAG_MS, 
Long.parseLong(entry.getValue().getAvailabilityLagMs()));
+          } catch (NumberFormatException nfe) {
+            // do not do anything
+            _segmentLogger.debug("Failed to parse the availability lag {} 
returned from the consumer for partition {}",
+                lagState.getRecordsLag(), partitionId);
+            emitAvailabilityLag = false;

Review Comment:
   We can break the loop here, no need for additional checks



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