jiajunwang commented on a change in pull request #686: Add resource partition
weight gauge
URL: https://github.com/apache/helix/pull/686#discussion_r368193942
##########
File path:
helix-core/src/main/java/org/apache/helix/monitoring/mbeans/ResourceMonitor.java
##########
@@ -382,6 +367,37 @@ public void updateRebalancerStats(long
numPendingRecoveryRebalancePartitions,
_numLoadRebalanceThrottledPartitions.updateValue(numLoadRebalanceThrottledPartitions);
}
+ /**
+ * Updates partition weight metric. If the partition capacity keys are
changed, all MBean
+ * attributes will be updated accordingly: old capacity keys will be
replaced with new capacity
+ * keys in MBean server.
+ *
+ * @param partitionWeightMap A map of partition weight: capacity key ->
partition weight
+ */
+ void updatePartitionWeightStats(Map<String, Integer> partitionWeightMap) {
+ synchronized (_dynamicCapacityMetricsMap) {
+ if
(_dynamicCapacityMetricsMap.keySet().equals(partitionWeightMap.keySet())) {
+ for (Map.Entry<String, Integer> entry : partitionWeightMap.entrySet())
{
+ _dynamicCapacityMetricsMap.get(entry.getKey()).updateValue((long)
entry.getValue());
+ }
+ return;
+ }
+
+ // Capacity keys are changed, so capacity attribute map needs to be
updated.
+ _dynamicCapacityMetricsMap.clear();
+ final String gaugeMetricSuffix = "Gauge";
Review comment:
nit, static final and put to the class level?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]