You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/12/15 22:09:36 UTC

[GitHub] [pinot] PrachiKhobragade commented on a diff in pull request #9977: Emit consumer partition lag from the server

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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org