somandal commented on code in PR #16856:
URL: https://github.com/apache/pinot/pull/16856#discussion_r2382840980
##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/OfflineSegmentValidationManager.java:
##########
@@ -73,7 +97,38 @@ 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) {
+ UtilizationChecker.CheckResult result =
+
_resourceUtilizationManager.isResourceUtilizationWithinLimits(tableNameWithType,
+ UtilizationChecker.CheckPurpose.TASK_GENERATION);
+ if (result == 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);
+ } else if (result == UtilizationChecker.CheckResult.PASS) {
+ LOGGER.info("Resource utilization is within limits for table: {},
setting metric to 0", tableNameWithType);
+ _controllerMetrics.setOrUpdateTableGauge(tableNameWithType,
ControllerGauge.RESOURCE_UTILIZATION_LIMIT_EXCEEDED,
+ 0L);
+ } else {
+ LOGGER.debug("Resource utilization check result is UNDETERMINED for
table: {}, no action taken",
Review Comment:
nit: make this info? i might be helpful to know why the metric isn't getting
updated in case we expect it to
--
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]