Skip to content

fix(integrations): Read dataset-specific query params in explore unfurls#113304

Merged
DominikB2014 merged 6 commits intomasterfrom
dominikbuszowiecki/dain-1553-logs-url-unfurls-dont-read-filters
Apr 17, 2026
Merged

fix(integrations): Read dataset-specific query params in explore unfurls#113304
DominikB2014 merged 6 commits intomasterfrom
dominikbuszowiecki/dain-1553-logs-url-unfurls-dont-read-filters

Conversation

@DominikB2014
Copy link
Copy Markdown
Contributor

@DominikB2014 DominikB2014 commented Apr 17, 2026

Logs URLs use logsQuery and logsAggregateSortBys for their query and sort
parameters, but the Slack unfurl code only read the generic query and
aggregateSort keys. This meant logs unfurls never included the user's
search filters.

Consolidates the per-dataset defaults (ExploreDatasetDefaults) into a
single ExploreDatasetConfig that also carries query_key and sort_key,
so the param mapping is data-driven instead of inline conditionals. Spans
and metrics are unaffected — spans already used query/aggregateSort,
and metrics extract both from the metric JSON param.

Fixes DAIN-1553

Logs URLs use `logsQuery` and `logsSortBys` for their query and sort
parameters, but the unfurl code only read the generic `query` and
`aggregateSort` keys. Map the correct URL param key based on the
detected dataset so logs unfurls include the user's filters.

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

linear-code Bot commented Apr 17, 2026

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 17, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 33b09ef. Configure here.

Comment thread src/sentry/integrations/slack/unfurl/explore.py
Merge ExploreDatasetDefaults into a single ExploreDatasetConfig that
includes query_key, sort_key, title_prefix, and default_y_axis. This
makes dataset-specific URL param mappings data-driven instead of
inline conditionals. Also fix sort_key for logs to use the aggregate
sort param (logsAggregateSortBys) since unfurls render charts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DominikB2014 DominikB2014 marked this pull request as ready for review April 17, 2026 16:19
@DominikB2014 DominikB2014 requested review from a team as code owners April 17, 2026 16:19
@DominikB2014 DominikB2014 marked this pull request as draft April 17, 2026 16:20
@DominikB2014 DominikB2014 marked this pull request as ready for review April 17, 2026 16:20
Replace full-flow unfurl test with focused unit tests for the arg
mapper. Covers logs and spans query/sort param mapping without
needing to mock the API client or chart generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread src/sentry/integrations/slack/unfurl/explore.py Outdated
Use match_link instead of calling map_explore_query_args directly,
matching the pattern used by existing unfurl tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The frontend writes logsSortBys to most shared logs URLs (via
utils.tsx), not logsAggregateSortBys. Using the aggregate key meant
sorting was silently ignored for the common case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the standard assertion guard for match_link's nullable return
type to fix mypy index error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DominikB2014 DominikB2014 enabled auto-merge (squash) April 17, 2026 17:24
@DominikB2014 DominikB2014 merged commit 2df9e26 into master Apr 17, 2026
56 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/dain-1553-logs-url-unfurls-dont-read-filters branch April 17, 2026 17:32
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