Repository navigation
perf(sdk-updates): Read the SDK index once per event serialization - #129097
Merged
Merged
Conversation
Computing sdkUpdates read sentry:release-registry-sdk-versions from the cache once for the index state and again for every suggestion's sdkUrl, including both sides of each suggestion equality check. An outdated SDK caused six reads per event. SdkIndexState now reads the index once and derives versions and URLs from it, so data freshness is unchanged. get_sdk_versions also stops mutating settings.SDK_VERSIONS in place. Refs #128818 Co-Authored-By: BYK <[email protected]>
scttcper
approved these changes
Oct 28, 2026
BYK
enabled auto-merge (squash)
October 28, 2026 21:42
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.
IssueEventSerializercomputessdkUpdatesfor each event, and that computation read thesentry:release-registry-sdk-versionscache key several times per event. The index state read it once to build the versions map. EverySuggestion.to_json()read it again throughget_sdk_urls()to fill insdkUrl.Suggestion.__eq__callsto_json()on both sides, so eachsuggestion in parent_suggestionscheck read it twice more. With an outdated SDK, one serialization made 6 reads, measured by the new test before the fix.Now
SdkIndexStatereads the index once, lazily, and derives both the versions map and the URL map from that one read.to_json()takes the URL map from the index state. Equality no longer looks atsdkUrl, which is derived from the SDK name already being compared, so the result is the same. The result is one cache read per event serialization, which is one per request on the event details endpoints. Nothing is cached across requests and TTL semantics are unchanged. Data is as fresh as before: the 5-minute registry task with its 1h cache TTL still controls it. I didn't find an existing request-scoped cache helper. A process-levelttl_cachewould have added cross-request staleness and broken tests that seed the cache key, so I scoped the fix to the per-serialization path instead.get_sdk_versions()also copiessettings.SDK_VERSIONSnow instead of writing registry versions into it in place.get_sdk_urls()already copied.Why: 7-day estimates from sampled spans and Datadog, not exact counts. The key is fetched about 49M times a week, about 5 times per event details request at about 5 ms each, so roughly 28 ms per request. The event details endpoints serve about 14.6M (group) plus 4.2M (project) requests a week.
Context: #128818
via BYK.
--
View Junior Session in Sentry