Commit c92cdeb
fix(snuba): Handle direct project.id groupby in top event conditions (#109535)
Handle direct `project.id` groupby in `build_top_event_conditions`
When grouping by `project.id` directly in the timeseries spans endpoint,
the top events query returns data keyed by `"project.id"` with the
integer project ID as value. The existing code only handled the case
where `project.id` appeared as a derived groupby key (from grouping by
`project` or `project.name`), where the data contains the slug under a
`"project"` or `"project.slug"` key. This caused a `KeyError:
'project.slug'`.
The fix checks if the event data already has a `"project.id"` key and
uses the value directly, falling back to the slug-based lookup for the
derived case.
Fixes SENTRY-5KF8
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6b2b1db commit c92cdeb
File tree
2 files changed
+30
-3
lines changed- src/sentry/snuba
- tests/snuba/api/endpoints
2 files changed
+30
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
825 | 825 | | |
826 | 826 | | |
827 | 827 | | |
828 | | - | |
829 | | - | |
830 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
831 | 834 | | |
832 | 835 | | |
833 | 836 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2615 | 2615 | | |
2616 | 2616 | | |
2617 | 2617 | | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
0 commit comments