Repository navigation
chore: drop github per user rate limit tracking - #12286
Merged
Merged
Conversation
Rate limits for authenticated requests are per user. This would be an excessive number of prometheus labels, so we only track the unauthorized limit.
johnstcn
reviewed
Feb 23, 2024
johnstcn
left a comment
Member
There was a problem hiding this comment.
I think this makes sense, and I'm down for dropping unnecessary prom metrics 👍
Just need to make CI happy.
Member
Author
Forgot to fix the tests for the rate limits. On it 👍 |
johnstcn
approved these changes
Feb 23, 2024
matifali
reviewed
Feb 23, 2024
| # TYPE coderd_oauth2_external_requests_rate_limit_total gauge | ||
| coderd_oauth2_external_requests_rate_limit_total{name="primary-github",resource="core"} 5000 | ||
| coderd_oauth2_external_requests_rate_limit_total{name="secondary-github",resource="core"} 5000 | ||
| coderd_oauth2_external_requests_rate_limit_total{name="primary-github",resource="core-unauthorized"} 5000 |
Contributor
There was a problem hiding this comment.
Should this be 60 instead of 5000?
Member
Author
There was a problem hiding this comment.
It should be, but it's only used to generate docs. The values are ignored, but the labels are included.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Rate limits for authenticated requests are per user. This would be an excessive number of prometheus labels, so we only track the unauthorized limit.
The rate limit labels without a user label make no sense.
Closes: #10853
Unauthenticated Rate Limit
We used to hit the unauthenticated rate limit as our ValidateToken always required an external auth request. With #11830, we no longer waste an external auth request if we know the token is invalid.
Additionally, if we have an invalid token (say it was revoked), #11598 prevents us from constantly making an external auth request with the same invalid token in the "listen" loop. So when requiring a re authentication, we only trigger 1 request.
There is still improvement to be made, as an invalid token can trigger multiple requests if the user hits the same endpoint multiple times. The caching of "invalid" is only in the scope of 1 request atm. We could either persist the cached "invalid" to the db, or delete the link when we get a 401 back?