Skip to content

fix(explore): Derive default chart type for explore Slack unfurls#112717

Merged
DominikB2014 merged 2 commits intomasterfrom
dominikbuszowiecki/dain-1495-incorrect-default-chart_type-for-some-aggregates
Apr 10, 2026
Merged

fix(explore): Derive default chart type for explore Slack unfurls#112717
DominikB2014 merged 2 commits intomasterfrom
dominikbuszowiecki/dain-1495-incorrect-default-chart_type-for-some-aggregates

Conversation

@DominikB2014
Copy link
Copy Markdown
Contributor

When no explicit chartType is in the URL, the Slack unfurl always
rendered a line chart. But Explore defaults count/count_unique/sum
aggregates to bar charts and everything else to line.

Adds _resolve_display_type(chart_type, y_axes) which uses the URL's
chartType when present and otherwise derives the default from the
aggregate function name, matching the frontend's determineDefaultChartType.

Also stores chart_type as the raw int from the URL (instead of
pre-converting to a string) so the helper handles the full mapping.

Fixes DAIN-1495

When no explicit chartType is in the URL, the unfurl always rendered a
line chart. But Explore defaults count/count_unique/sum aggregates to
bar charts and everything else to line, via determineDefaultChartType.

Add _resolve_display_type helper that uses the URL's chartType when
present and otherwise derives the default from the aggregate function,
matching the frontend behavior.

Fixes DAIN-1495
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 10, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 10, 2026
Comment thread src/sentry/integrations/slack/unfurl/explore.py
Warden flagged that a malformed URL with a non-int chartType (e.g. a
list or dict) would crash dict.get() with TypeError. Use isinstance
check instead of a presence check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DominikB2014 DominikB2014 marked this pull request as ready for review April 10, 2026 19:32
@DominikB2014 DominikB2014 requested review from a team as code owners April 10, 2026 19:32
@DominikB2014 DominikB2014 enabled auto-merge (squash) April 10, 2026 19:33
@DominikB2014 DominikB2014 requested a review from a team April 10, 2026 19:33
@DominikB2014 DominikB2014 merged commit 3ac568e into master Apr 10, 2026
56 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/dain-1495-incorrect-default-chart_type-for-some-aggregates branch April 10, 2026 19:42
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.

2 participants