jtuglu-netflix commented on code in PR #17847:
URL: https://github.com/apache/druid/pull/17847#discussion_r2023373748


##########
server/src/main/java/org/apache/druid/segment/realtime/SegmentGenerationMetrics.java:
##########
@@ -110,6 +116,14 @@ public void reportMessageMaxTimestamp(long 
messageMaxTimestamp)
     this.messageMaxTimestamp.set(Math.max(messageMaxTimestamp, 
this.messageMaxTimestamp.get()));
   }
 
+  public void reportMessageGapAggregate(long messageGap)
+  {
+    final long newNumEvents = this.numMessageGapEvents.incrementAndGet();
+    this.minMessageGap.getAndAccumulate(messageGap, Math::min);
+    this.maxMessageGap.getAndAccumulate(messageGap, Math::max);
+    this.messageGapAvg.getAndUpdate(oldAvg -> oldAvg + ((messageGap - oldAvg) 
/ newNumEvents));

Review Comment:
   Sure, although it should always be to the nearest `ms`. I mainly kept as 
long since that's easier to work with atomically(it's also a bit slower per 
call). I'd need to interpret as raw bits if I want to use float/double 
atomically.



-- 
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]

Reply via email to