-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track Max & mean seconds to receive state messages #15586
Track Max & mean seconds to receive state messages #15586
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
meanSecondsBeforeStateMessageEmitted: | ||
type: integer | ||
maxSecondsBeforeStateMessageEmitted: | ||
type: integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment is probably valuable for future us - that this message is from the Source.
if (firstRecordReceivedAt == null) { | ||
firstRecordReceivedAt = DateTime.now(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 this is a global time, and not per-stream
when(messageTracker.getMaxSecondsToReceiveStateMessage()).thenReturn(10L); | ||
when(messageTracker.getMeanSecondsToReceiveStateMessage()).thenReturn(8L); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 testing the math
this.maxSecondsToReceiveStateMessage = new AtomicLong(0L); | ||
this.meanSecondsToReceiveStateMessage = new AtomicLong(0L); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 These values will always be numeric (never null)
3635a31
to
8f19838
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the types we are using. From this PR, it looks like we are using AtomicLong but don't really have any concurrency issues.
maxSecondsToReceiveSourceStateMessage.set(secondsSinceLastStateMessage); | ||
} | ||
|
||
if (meanSecondsToReceiveSourceStateMessage.get() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering why are we using AtomicLong
? Overall, it feels like we should be either using a Long or trying to leverage the atomic updates such as compareAndExchange
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mostly just following the convention in the messagetracker for how we're tracking the other data
* Segment tracking for max and mean seconds to receive state message from source
Track max and mean seconds before receiving state message in Segment.