Skip to content

ref(allocation-policies): Simplify concurrency policy config - #8643

Closed
dezzeddi wants to merge 6 commits into
masterfrom
dani/concurrency-policies-config-keys
Closed

dezzeddi wants to merge 6 commits into
masterfrom
dani/concurrency-policies-config-keys

Conversation

@dezzeddi

@dezzeddi dezzeddi commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Simplifies the concurrency policies. One commit per change.

No behaviour change with current config: none of the removed settings is set in any region, and the new key_by default keeps today's Redis bucket, so no running count resets.

  • Remove CrossOrgQueryAllocationPolicy. It never limits a query: no config sets its referrer limits, and the only queries marked cross_org_query read storages where it isn't configured. Also drops the cross_org_referrer_limits schema property and comments claiming it gates outcomes_cross_org_hourly.
  • ConcurrentRateLimitAllocationPolicy: key_by. Replaces four *_override parameterized settings. key_by picks the tenant the count is kept for: tenant (default), organization or organization_referrer. The organization buckets use the names the removed overrides used.
  • ReferrerGuardRailPolicy: concurrent_limit. Replaces referrer_concurrent_override, using the same name as ConcurrentRateLimitAllocationPolicy. If unset, default_concurrent_request_per_referrer still applies. The throttle threshold now follows the effective limit (same result for current config).
  • Hard-code rate_limit_shard_factor to 1. It is unset everywhere, and another value would move every count to new keys.
  • Remove DeleteConcurrentRateLimitAllocationPolicy. The delete path never loads it, so its only config entries (search_issues in two regions) ran it on reads, as a second shadow limiter.
  • Template method. BaseConcurrentRateLimitAllocationPolicy runs the count, check and release flow; subclasses supply hooks. ConcurrentRateLimitAllocationPolicy still releases pass-through-referrer queries; ReferrerGuardRailPolicy releases with its real limit instead of a placeholder (the limit isn't read on release).
  • Schema: key_by allowed as a string on policies.

The resolver skips unknown policy names with a warning, so this can deploy before or after the config change. Replaces #8626, #8634, #8635, #8636, #8637, #8641.

It only limits queries with tenant_ids.cross_org_query set or a referrer in
cross_org_referrer_limits. No config sets cross_org_referrer_limits, and
cross_org_query is only set by the outcomes routing queries, which read storages
the policy is not configured on, so it passes every query through.
…Policy

Replace the four *_override param configs with key_by, which picks the tenant
the concurrency count is kept for: tenant (default, today's bucket),
organization or organization_referrer. Per-tenant limits go in match blocks
as concurrent_limit. No override is set in any region today.
…licy

Replace referrer_concurrent_override (param referrer) with concurrent_limit,
the same name ConcurrentRateLimitAllocationPolicy uses. Per-referrer values go
in match blocks. default_concurrent_request_per_referrer still applies when
concurrent_limit is unset. The throttle threshold now follows the effective
limit.
rate_limit_shard_factor is a per-policy config on every concurrency policy
but is not set in any region. Remove the config and use 1.
…olicy

It is ConcurrentRateLimitAllocationPolicy with query_type DELETE, but the
delete path never loads policies from sentry-options and the resolver
ignores query_type. Its only config entries (us and de search_issues reads)
make it a second read-path concurrency limiter with its own Redis bucket.
An unknown class name in config is skipped with a warning, so this and the
config removal can deploy in either order.
ConcurrentRateLimitAllocationPolicy and ReferrerGuardRailPolicy each
re-implemented the same count-check-end flow.
BaseConcurrentRateLimitAllocationPolicy now runs it; subclasses supply the
bucket and limit, which queries they skip, and how a decision becomes an
allowance. Buckets, limits, explanations and decisions are unchanged.
@dezzeddi

Copy link
Copy Markdown
Member Author

Combined into #8644.

@dezzeddi dezzeddi closed this Oct 30, 2026
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.

1 participant