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.
This PR comes after a lot of debugging and discovering some unexpected behavior in our underlying rate limit library. Notably, it did not handle transitioning from
rate.Inf
as expected. This PR refactors and corrects to desired behavior and reduces some complexity/runtime costs by no longer depending on the per tenant rate limiter from Cortex.edit:
Further explanation from the library docs, as a special case:
A zero Burst allows no events, unless limit == Inf.
However, a zero burst value also causes the token bucket to never fill. This presents a problem when updating the limiter's parameters during runtime. The limiter will reconfigure itself properly, but as it didn't have any tokens prior, it will reject the first request as it has no available budget. This is why we see issues during ingester rollout: only series which were present in WAL replay and thus initialized with
NewLimiter(rate.Inf, 0)
are affected. I've also included a test illustrating the behavior on the underlying library.