-
Notifications
You must be signed in to change notification settings - Fork 13
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
add CountSinceLastMeasurement and TotalSinceLastMeasurement that resets everytime its measured #32
Conversation
Thanks, I think this is a useful change. What do you think about calling these two classes Also, I am thinking about two potential scope creeps, which probably do not need to be addressed in this PR, but I'd like to hear if you have thoughts on them...
|
Thanks @FelixGV for the comments
Though the names suggested feels a bit too descriptive, I believe it's better than being cryptic which was the case before. I am onboard. thanks.
Took a look at the code and it needs some refactoring like you mentioned as it's the same set functions that gets called on both the paths. For now, made these 2 new classes to throw an exception during
That is a good suggestion. I will take a stab at this along with the above refactoring with a separate PR. |
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.
Thanks Manoj, looks great!
CountSinceLastMeasurement
that resets the count everytime its measuredSimple version of
SampledCount
, this aggregates counts as a single sample and gets reset to 0 every time it is measured. The sample window is just the time between measurements unlikeSampledCount
which can be defined by number of events or elapsed time. Measure every second to get count per second. Measure every minute to get count per minute. Measure adhoc to get the delta count since the last measurement.TotalSinceLastMeasurement
that resets the total everytime its measuredThese classes doesn't support quota currently as it resets everytime it's measured which probably need a refactoring where the
measure
call triggered from the quota path does not cause a reset, and only themeasure
call from theMetricsReporter
end up triggering the reset.