Skip to content

fix(dynamic-sampling): Cap dsc.transaction at 200 characters in the per-org pipeline - #120806

Closed
shellmayr wants to merge 2 commits into
masterfrom
ds/cap-dsc-transaction-length
Closed

fix(dynamic-sampling): Cap dsc.transaction at 200 characters in the per-org pipeline#120806
shellmayr wants to merge 2 commits into
masterfrom
ds/cap-dsc-transaction-length

Conversation

@shellmayr

@shellmayr shellmayr commented Jul 29, 2026

Copy link
Copy Markdown
Member
  • Caps sentry.dsc.transaction at 200 characters in get_eap_transaction_volumes. Longer names cannot be matched by a sampling rule, so a per-name rate for them cannot be served.
  • Counts every over-length name as one class under the empty transaction name "".
  • Gated behind dynamic-sampling.per_org.cap-dsc-transaction-length-org-ids, a list of organization ids. The default [] keeps counting every transaction by name, so nothing changes until the option names an org.
  • Applies the cap in the query, not after it. The RPC has no length function, so the length test is a ClickHouse LIKE pattern of 201 _ wildcards plus %.
  • Off the gate: one query, no length filter, byte-identical to today. On the gate: two queries, the top-N one excluding over-length names and a second summing them per project. So the extra query cost only applies to the orgs being tested.
  • The lumped class competes for a top-N slot like any named one, so no over-length volume can be lost to the cap.
  • Exposes extra_conditions on Spans.run_table_query, the same way limit_by is exposed.
  • Adds four tests in tests/sentry/dynamic_sampling/per_org/test_queries.py, covering both sides of the gate.

Contributes to TET-2754

…er-org pipeline

Transaction names longer than 200 characters cannot be matched by a sampling rule,
so a per-name rate for them cannot be served. Count every over-length name as one
class under the empty transaction name instead of individually.

The cap runs in the query. The RPC has no length function, so the length test is a
ClickHouse LIKE pattern of 201 `_` wildcards plus `%`. That splits the fetch into
two queries: the per-project top-N one excludes over-length names, and a second one
sums them per project. The lumped class then competes for a top-N slot like any
named one, so no over-length volume is lost to the cap.
@linear-code

linear-code Bot commented Jul 29, 2026

Copy link
Copy Markdown

TET-2754

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 29, 2026
… option

Add dynamic-sampling.per_org.cap-dsc-transaction-length-org-ids, a list of
organization ids for which get_eap_transaction_volumes caps dsc.transaction at
200 characters. The default of [] keeps counting every transaction by name, so
this changes nothing until the option names an org.

Off the gate the function issues one query with no length filter, exactly as
before. On the gate it issues two, so the extra query cost only applies to the
orgs being tested.
@shellmayr

Copy link
Copy Markdown
Member Author

Too cumbersome - superseded by getsentry/relay#6271

@shellmayr shellmayr closed this Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant