-
Notifications
You must be signed in to change notification settings - Fork 369
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
Update effective_rate calculation #1236
Conversation
Python has to update since they have it slightly wrong. We want to change the formula from:
to
It'll give us more consistently accurate values over the two windows. |
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.
did we need to adjust any tests for this?
@brettlangdon Updated the specs to have tests more specific to the behavior we've added, as our previous tests were a bit too broad to ensure we can prevent a regression here. |
Summary
This PR Updates the Effective Rate calculation of the Rule Sampler. According to Spec, the effective rate should be the average of the last 2 time windows, each time window 1s each.
Notes
I mainly tried to mimic the
dd-trace-py
https://github.com/DataDog/dd-trace-py/blob/8c450b56ba87cd8cab916bb579a01837c35b0c01/ddtrace/internal/rate_limiter.py#L7 approach. We have some existing tests that mock a >1s time period and they all still pass, but if there's conditions we should test here I can try to add them.