kfaraz commented on code in PR #17847:
URL: https://github.com/apache/druid/pull/17847#discussion_r2094826737
##########
server/src/main/java/org/apache/druid/segment/realtime/SegmentGenerationMetrics.java:
##########
@@ -55,6 +55,65 @@ public class SegmentGenerationMetrics
private final AtomicLong maxSegmentHandoffTime = new
AtomicLong(NO_EMIT_SEGMENT_HANDOFF_TIME);
+ public static class MessageGapStats
+ {
+ long minMessageGap = Long.MAX_VALUE;
+ long maxMessageGap = Long.MIN_VALUE;
+ long numMessageGap = 0;
+ double totalMessageGap = 0;
+
+ public synchronized double avgMessageGap()
Review Comment:
Aah, I see what you mean. Thanks for the explanation, @jtuglu-netflix !
> Agreed. I don't see why the add needs to be synchronized either. Can it be
accessed by multiple threads?
I have been under the impression that the object will not need to be
accessed by multiple threads,
but since that is clearly not the case, let's fix it up.
Your first approach probably made most sense as there is no point using both
`AtomicReference` and `synchronized` methods.
Please create a follow up PR as you see fit.
--
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]