Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2764#discussion_r208965327
  
    --- Diff: 
storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java ---
    @@ -2826,9 +2915,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 --
    
    Why would there be a loss of precision? The input number is a long, which 
is an integral type (not floating point). 


---

Reply via email to