-
Notifications
You must be signed in to change notification settings - Fork 1k
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 moving average stats #789
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.
LGTM! great rate stats coming to Licode!!
erizo/src/erizo/stats/StatNode.cpp
Outdated
|
||
// if now is in the middle of an interval | ||
// add the proportional part of the current interval | ||
double interval_part = static_cast<double>((now_ms - (calculation_start_ms_ + |
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.
please consider calculating interval_part in another method, something like getCurrentIntervalProportion(now_ms);
erizo/src/erizo/stats/StatNode.cpp
Outdated
} | ||
int32_t intervals_to_pass = ((now_ms - real_interval) - | ||
(calculation_start_ms_ + available_window * interval_size_ms_) * interval_size_ms_) / interval_size_ms_; | ||
intervals_to_pass = intervals_to_pass < 0 ? 0 : intervals_to_pass; // can be less than zero in first value |
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.
consider intervals_to_pass = std::max(intervals_to_pass, 0);
erizo/src/erizo/stats/StatNode.cpp
Outdated
} | ||
|
||
uint64_t now_ms = ClockUtils::timePointToMs(clock_->now()); | ||
// We check if it's within the data we have |
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.
prefer moving logic to other self-explained methods vs adding comments
erizo/src/erizo/stats/StatNode.cpp
Outdated
uint64_t now_ms = ClockUtils::timePointToMs(clock_->now()); | ||
// We check if it's within the data we have | ||
uint32_t available_window = std::min(accumulated_intervals_, static_cast<uint64_t>(intervals_in_window_)); | ||
uint64_t min_requested_ms = std::max((now_ms - interval_to_calculate_ms), |
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.
please consider removing some parentheses:
uint64_t min_requested_ms = std::max(now_ms - interval_to_calculate_ms,
calculation_start_ms_ + (accumulated_intervals_ - available_window) * interval_size_ms_);
Description
Added two new types of stats:
-MovingIntervalRateStat: A new RateStat that can be configured with an interval size and the number of intervals to track. It can also calculate the rate for the whole window or a partial rate from the last n ms
Add a short description here, please.
[X] It needs and includes Unit Tests
Changes in Client or Server public APIs
None.
Add a detailed description of any change in the public APIs.
[] It includes documentation for these changes in
/doc
.