Jackie-Jiang commented on code in PR #12403:
URL: https://github.com/apache/pinot/pull/12403#discussion_r1501220074
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/SegmentStatusChecker.java:
##########
@@ -354,39 +356,33 @@ protected void nonLeaderCleanup(List<String>
tableNamesWithType) {
private void removeMetricsForTable(String tableNameWithType) {
LOGGER.info("Removing metrics from {} given it is not a table known by
Helix", tableNameWithType);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.NUMBER_OF_REPLICAS);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.PERCENT_OF_REPLICAS);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.PERCENT_SEGMENTS_AVAILABLE);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.IDEALSTATE_ZNODE_SIZE);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.IDEALSTATE_ZNODE_BYTE_SIZE);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.SEGMENT_COUNT);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.SEGMENT_COUNT_INCLUDING_REPLACED);
-
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.SEGMENTS_IN_ERROR_STATE);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.SEGMENTS_WITH_LESS_REPLICAS);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.PERCENT_SEGMENTS_AVAILABLE);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.TABLE_DISABLED);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.TABLE_CONSUMPTION_PAUSED);
- _controllerMetrics.removeTableGauge(tableNameWithType,
ControllerGauge.TABLE_REBALANCE_IN_PROGRESS);
+ for (ControllerGauge metric : ControllerGauge.values()) {
+ if (!metric.isGlobal()) {
+ _controllerMetrics.removeTableGauge(tableNameWithType, metric);
+ }
+ }
+
+ for (ControllerMeter metric : ControllerMeter.values()) {
+ if (!metric.isGlobal()) {
+ _controllerMetrics.removeTableMeter(tableNameWithType, metric);
+ }
+ }
+
+ for (ControllerTimer metric : ControllerTimer.values()) {
+ if (!metric.isGlobal()) {
+ _controllerMetrics.removeTableTimer(tableNameWithType, metric);
+ }
+ }
}
private void setStatusToDefault() {
Review Comment:
Let's rename this method to `removeMetricsForAllTables()`.
We should not call this method in `setUpTask()` because it might clean up
metrics updated by other services. Maybe we should not call it in
`cleanUpTask()` as well.
--
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]