Skip to content

ref(outcomes-routing): honor RequestMeta.standard_retention_days - #7912

Merged
phacops merged 12 commits into
masterfrom
meredith/4-28-26
Jul 31, 2026
Merged

ref(outcomes-routing): honor RequestMeta.standard_retention_days#7912
phacops merged 12 commits into
masterfrom
meredith/4-28-26

Conversation

@MeredithAnya

@MeredithAnya MeredithAnya commented Apr 28, 2026

Copy link
Copy Markdown
Member

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.

OutcomesBasedRoutingStrategy now derives the standard retention window as:

  • if RequestMeta.standard_retention_days is present and positive: min(request value, max_standard_retention_days)
  • otherwise: default_standard_retention_days

Queries whose start is older than that window are forced to TIER_8 when enable_long_term_retention_downsampling is enabled (and the item type is not in ITEM_TYPE_FULL_RETENTION). Volume-based downsampling can still apply on top of that.

Options

Option Default Purpose
default_standard_retention_days 30 Fallback window when the request does not send a positive standard_retention_days
max_standard_retention_days 90 Upper bound applied to positive request values

Changes

  • Bump sentry-protos to 0.57.0 (Python + Rust)
  • Honor RequestMeta.standard_retention_days in OutcomesBasedRoutingStrategy
  • Add default_standard_retention_days and max_standard_retention_days sentry-options
  • Add tests for extended retention, max/default option overrides, and non-positive fallback

API

Field lives on RequestMeta, not inside DownsampledStorageConfig:

  • DownsampledStorageConfig controls sampling/routing mode
  • standard_retention_days is the organization's standard retention window used as the age threshold before long-term retention downsampling

Depends on

getsentry/sentry-protos#226 (merged, released as 0.57.0)

@MeredithAnya
MeredithAnya requested review from a team as code owners April 28, 2026 20:49
@phacops phacops changed the title ref(outcomes-routing): check request retention_days ref(outcomes-routing): honor customer_standard_retention_days_config Jul 31, 2026
@phacops phacops changed the title ref(outcomes-routing): honor customer_standard_retention_days_config ref(outcomes-routing): honor standard_retention_days Jul 31, 2026
Use RequestMeta.standard_retention_days for long-term retention routing
and cover extended / invalid retention windows in outcomes-based tests.
Comment thread snuba/web/rpc/storage_routing/routing_strategies/outcomes_based.py Outdated
phacops added 5 commits July 31, 2026 13:01
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.
@phacops phacops changed the title ref(outcomes-routing): honor standard_retention_days ref(outcomes-routing): honor RequestMeta.standard_retention_days Jul 31, 2026
Parametrize request values and option overrides in one test, and simplify
the routing decision helper.
@phacops
phacops enabled auto-merge (squash) July 31, 2026 23:21
Comment thread snuba/web/rpc/storage_routing/routing_strategies/outcomes_based.py
@phacops
phacops merged commit 0855c7c into master Jul 31, 2026
69 checks passed
@phacops
phacops deleted the meredith/4-28-26 branch July 31, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants