somandal commented on code in PR #15518:
URL: https://github.com/apache/pinot/pull/15518#discussion_r2043088823


##########
pinot-common/src/main/java/org/apache/pinot/common/metrics/ControllerGauge.java:
##########
@@ -205,7 +205,12 @@ public enum ControllerGauge implements 
AbstractMetrics.Gauge {
   
PAUSELESS_SEGMENTS_IN_UNRECOVERABLE_ERROR_COUNT("pauselessSegmentsInUnrecoverableErrorCount",
 false),
 
   // ZK JUTE max buffer size in bytes
-  ZK_JUTE_MAX_BUFFER("zkJuteMaxBuffer", true);
+  ZK_JUTE_MAX_BUFFER("zkJuteMaxBuffer", true),
+
+  // The progress of a certain table rebalance job of a table
+  TABLE_REBALANCE_JOB_ADDING_PROGRESS_PERCENT("percent", false),
+  TABLE_REBALANCE_JOB_DELETING_PROGRESS_PERCENT("percent", false);

Review Comment:
   nit: can we call them:
   `TABLE_REBALANCE_JOB_SEGMENT_ADDITION_PROGRESS_PERCENTAGE`
   `TABLE_REBALANCE_JOB_SEGMENT_DELETETION_PROGRESS_PERCENTAGE`
   
   Just don't use `adding` and `deleting`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ZkBasedTableRebalanceObserver.java:
##########
@@ -205,6 +208,22 @@ public int getNumUpdatesToZk() {
     return _numUpdatesToZk;
   }
 
+  /**
+   * Emits the rebalance progress in percent to the metrics. Uses the 
percentage of remaining segments to be added as
+   * the indicator of the overall progress.
+   * @param overallProgress the latest overall progress
+   */
+  private void 
emitProgressMetric(TableRebalanceProgressStats.RebalanceProgressStats 
overallProgress) {
+    // Using the original job ID to group rebalance retries together with the 
same label
+    _controllerMetrics.setValueOfTableGauge(_tableNameWithType + "." + 
_tableRebalanceContext.getOriginalJobId(),
+        ControllerGauge.TABLE_REBALANCE_JOB_ADDING_PROGRESS_PERCENT,
+        (long) overallProgress._percentageRemainingSegmentsToBeAdded * 100);
+
+    _controllerMetrics.setValueOfTableGauge(_tableNameWithType + "." + 
_tableRebalanceContext.getOriginalJobId(),
+        ControllerGauge.TABLE_REBALANCE_JOB_DELETING_PROGRESS_PERCENT,
+        (long) overallProgress._percentageRemainingSegmentsToBeDeleted * 100);

Review Comment:
   The stats are already multiplied by 100, you don't need to do that here



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ZkBasedTableRebalanceObserver.java:
##########
@@ -205,6 +208,22 @@ public int getNumUpdatesToZk() {
     return _numUpdatesToZk;
   }
 
+  /**
+   * Emits the rebalance progress in percent to the metrics. Uses the 
percentage of remaining segments to be added as
+   * the indicator of the overall progress.
+   * @param overallProgress the latest overall progress
+   */
+  private void 
emitProgressMetric(TableRebalanceProgressStats.RebalanceProgressStats 
overallProgress) {
+    // Using the original job ID to group rebalance retries together with the 
same label
+    _controllerMetrics.setValueOfTableGauge(_tableNameWithType + "." + 
_tableRebalanceContext.getOriginalJobId(),
+        ControllerGauge.TABLE_REBALANCE_JOB_ADDING_PROGRESS_PERCENT,
+        (long) overallProgress._percentageRemainingSegmentsToBeAdded * 100);

Review Comment:
   The stats are already multiplied by 100, you don't need to do that here



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to