feat(dynamic-sampling): add per-project volume query #114286
1 issue
sentry-backend-bugs: Found 1 issue (1 medium)
Medium
Unguarded dict access on 'sentry.dsc.root_project' can raise KeyError/TypeError - `src/sentry/dynamic_sampling/per_org/tasks/queries.py:146`
Row access uses row["sentry.dsc.root_project"] without a presence/None check, then wraps it with int(...). If Snuba returns rows where this column is missing (e.g., spans without a DSC root project tag) or where the value is None, this raises KeyError or TypeError, aborting the entire per-project volume computation for the organization. The sibling helper _get_aggregate_int was explicitly hardened in this same diff to handle None, but the group-by key was not, leaving an inconsistent safety posture.
⏱ 35.8s · 170.2k in / 1.4k out · $0.93 (+verification: $0.66)
Annotations
Check warning on line 146 in src/sentry/dynamic_sampling/per_org/tasks/queries.py
sentry-warden / warden: sentry-backend-bugs
Unguarded dict access on 'sentry.dsc.root_project' can raise KeyError/TypeError
Row access uses `row["sentry.dsc.root_project"]` without a presence/None check, then wraps it with `int(...)`. If Snuba returns rows where this column is missing (e.g., spans without a DSC root project tag) or where the value is None, this raises KeyError or TypeError, aborting the entire per-project volume computation for the organization. The sibling helper `_get_aggregate_int` was explicitly hardened in this same diff to handle None, but the group-by key was not, leaving an inconsistent safety posture.