Github user srdo commented on a diff in the pull request: https://github.com/apache/storm/pull/2754#discussion_r209039163 --- Diff: storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java --- @@ -2826,9 +2890,22 @@ public void launchServer() throws Exception { .parallelStream() .mapToDouble(SupervisorResources::getTotalCpu) .sum()); - + StormMetricsRegistry.registerGauge("nimbus:longest-scheduling-time-ms", () -> { + Long currTime = Time.nanoTime(); + Long startTime = schedulingStartTime.get(); + //There could be race condition here but seems trivial, elapsed is + // guaranteed to be no longer than real elapsed time of scheduling + Long longest = longestSchedulingTime.get(); + if (startTime != null) { + longest = currTime - startTime > longest ? currTime - startTime : longest; + } + //To millis. How should I put the constant for magic numbers? --- End diff -- I'm happy either way, to me tracking less than a millisecond isn't very useful, but leaving it like this is fine too.
---