Repository navigation
perf(ratelimit): Skip org lookup RPC for sentry app tokens - #126661
Merged
Merged
Conversation
Rate limiting sentry app requests made an RPC to control just to get the installation's org. The token on the request already carries it, the cell's ApiTokenReplica org is re-replicated when installations change. Only fall back to the RPC when it's missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scttcper
marked this pull request as ready for review
October 6, 2026 21:51
ApiToken.organization_id is a property that queries control silo tables, so reading it in a cell blew up and the middleware failed open. Only read the org off AuthenticatedToken and ApiTokenReplica, raw ApiTokens keep using the RPC. Adds back a test that asserts sentry app tokens skip the RPC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
markstory
approved these changes
Oct 8, 2026
Comment on lines
+97
to
+98
| # Sentry app tokens carry their installation's organization. ApiToken computes it | ||
| # with control silo queries, so it's left to the RPC fallback below. |
Member
There was a problem hiding this comment.
Do we need this comment? The logic flow below explains the purpose well enough.
scttcper
commented
Oct 8, 2026
This branch was successfully deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 limiting sentry app requests makes an RPC to control (
get_installation_org_id_by_token_id) just to get the installation's org. The token on the request already carries it: the cell'sApiTokenReplica.organization_id(#58490) is re-replicated when installations change. This uses that and only falls back to the RPC when it's missing.Follows #76068 and #76258, which narrowed this RPC to cut latency. #65403 assumed the org couldn't be read off the token in every silo, but
AuthenticatedTokencopies it from both the replica andApiToken.That RPC runs ~935k times an hour, averaging 47ms (~150ms from DE). Example trace