ref(outcomes-routing): honor RequestMeta.standard_retention_days - #7912
Merged
Conversation
Use RequestMeta.standard_retention_days for long-term retention routing and cover extended / invalid retention windows in outcomes-based tests.
Accept any positive standard_retention_days and clamp it to 90 instead of requiring membership in VALID_RETENTION_DAYS.
Drop the redundant HasField check and collapse the retention routing tests into one parametrized case with a small helper.
Add max_standard_retention_days (default 90) so the full-fidelity retention cap can be tuned without a code change.
Use a routing-specific standard_retention_days default (30) instead of LOWER_RETENTION_DAYS, and name the retention window consistently.
Avoid colliding with RequestMeta.standard_retention_days and make the fallback option name explicit.
Parametrize request values and option overrides in one test, and simplify the routing decision helper.
phacops
approved these changes
Jul 31, 2026
phacops
enabled auto-merge (squash)
July 31, 2026 23:21
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.
Summary
When we initially added the 30-day check in #7424, the assumption was that data older than 30 days would always be routed to downsampled storage.
The default should still be 30 days, but some organizations retain standard-fidelity data longer than that. Callers should send the organization's standard retention on the request so Snuba can route with that context instead of assuming 30 days for everyone.
OutcomesBasedRoutingStrategynow derives the standard retention window as:RequestMeta.standard_retention_daysis present and positive:min(request value, max_standard_retention_days)default_standard_retention_daysQueries whose start is older than that window are forced to
TIER_8whenenable_long_term_retention_downsamplingis enabled (and the item type is not inITEM_TYPE_FULL_RETENTION). Volume-based downsampling can still apply on top of that.Options
default_standard_retention_days30standard_retention_daysmax_standard_retention_days90Changes
sentry-protosto 0.57.0 (Python + Rust)RequestMeta.standard_retention_daysinOutcomesBasedRoutingStrategydefault_standard_retention_daysandmax_standard_retention_dayssentry-optionsAPI
Field lives on
RequestMeta, not insideDownsampledStorageConfig:DownsampledStorageConfigcontrols sampling/routing modestandard_retention_daysis the organization's standard retention window used as the age threshold before long-term retention downsamplingDepends on
getsentry/sentry-protos#226 (merged, released as 0.57.0)