Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2764#discussion_r208970103 --- Diff: storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java --- @@ -2807,16 +2897,15 @@ public void launchServer() throws Exception { } }); - StormMetricsRegistry.registerGauge("nimbus:num-supervisors", () -> state.supervisors(null).size()); - StormMetricsRegistry.registerGauge("nimbus:fragmented-memory", this::fragmentedMemory); - StormMetricsRegistry.registerGauge("nimbus:fragmented-cpu", this::fragmentedCpu); - StormMetricsRegistry.registerGauge("nimbus:available-memory", () -> nodeIdToResources.get().values() + //Be cautious using method reference instead of lambda. subexpression preceding :: will be evaluated only upon evaluation + // Num supervisor, and fragmented resources have been included in cluster summary + StormMetricsRegistry.registerGauge("nimbus:total-available-memory (nonegative)", () -> nodeIdToResources.get().values() .parallelStream() - .mapToDouble(SupervisorResources::getAvailableMem) + .mapToDouble(supervisorResources -> Math.max(supervisorResources.getAvailableMem(), 0)) .sum()); - StormMetricsRegistry.registerGauge("nimbus:available-cpu", () -> nodeIdToResources.get().values() + StormMetricsRegistry.registerGauge("nimbus:available-cpu (nonnegative)", () -> nodeIdToResources.get().values() --- End diff -- Thanks. Sorry I was unclear. What I meant what I don't know if we need to worry about not changing the names of existing metrics (backward compatibility). I'm not sure why we want to change the name to include `(nonnegative)`, and if we want to include it, why not use the same syntax as the rest of the name (words separated by `-`)?
---