Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Approximately rate-limited Sampler prototype #2180
Approximately rate-limited Sampler prototype #2180
Changes from all commits
74e3de8
51f97ab
7a4da70
122ce69
d92f043
a40fe2b
508c171
57761da
f066662
909b93c
de76191
6faa06c
a923a97
f2754bc
31caad4
ec930a6
3d6c6ed
3212bc4
5344f32
97c4754
dc1fc92
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The problem I see here is that the sampling rate will get less and less adaptive over time, as the current count and duration values have less and less influence on the the totalCount and the totalDuration and therefore also on the predicted rate. For example, if there is a continuous load of 100 spans per second over weeks and suddenly drops to 1 span per second, it will take very long until the sampling rate is adjusted correspondingly. I think there is the need of some forgetting mechanism. I think a second parameter is needed (in addition to the target rate) that controls the forgetting factor / adaption rate.
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 think I've misled you with a poorly chosen variable name. The
totalCount
andtotalDuration
used for estimation should be the sum over two windows every time (assuming the initial state has a prior of 0 count, 0 duration). Thes.priorCount
ands.priorDuration
are set to this window's count and duration for use in the next round.The predicted rate is just the average rate over the two windows. I suppose this is just a heuristic -- we could use exponential averaging or any number of techniques to forecast the upcoming rate based on recently observed rates.