noob-se7en commented on code in PR #16856:
URL: https://github.com/apache/pinot/pull/16856#discussion_r2379733857


##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/OfflineSegmentValidationManager.java:
##########
@@ -73,7 +97,35 @@ protected void processTable(String tableNameWithType) {
         LOGGER.warn("Failed to find table config for table: {}, skipping 
validation", tableNameWithType);
         return;
       }
-      validateOfflineSegmentPush(tableConfig);
+      updateResourceUtilizationMetric(tableNameWithType);
+
+      // Validations that involve fetching segment ZK metadata for all the 
segments are run at a lower frequency
+      // than operations that are done at table level
+      if (context._runSegmentLevelValidation) {
+        validateOfflineSegmentPush(tableConfig);
+      }
+    }
+  }
+
+  /**
+   * Updates the resource utilization metric for the given table.
+   * Sets the RESOURCE_UTILIZATION_LIMIT_EXCEEDED gauge to 1 if resource 
utilization is above limits (FAIL),
+   * or to 0 if within limits (PASS). The metric is not updated when the 
result is UNDETERMINED.
+   *
+   * @param tableNameWithType the table name with type for which to update the 
metric
+   */
+  private void updateResourceUtilizationMetric(String tableNameWithType) {
+    if 
(_resourceUtilizationManager.isResourceUtilizationWithinLimits(tableNameWithType,
+        UtilizationChecker.CheckPurpose.TASK_GENERATION) == 
UtilizationChecker.CheckResult.FAIL) {
+      LOGGER.warn("Resource utilization is above threshold for table: {}, 
setting metric to 1", tableNameWithType);
+      _controllerMetrics.setOrUpdateTableGauge(tableNameWithType, 
ControllerGauge.RESOURCE_UTILIZATION_LIMIT_EXCEEDED,
+          1L);
+      return;

Review Comment:
   nit
   ```suggestion
   ```



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