fix(slack): Use only first chart when unfurling multi-aggregate Explore URLs#113303
Merged
DominikB2014 merged 5 commits intomasterfrom Apr 17, 2026
Conversation
…re URLs Explore URLs can contain multiple aggregateField entries, each of which is a separate chart (per Explore's Visualize.fromJSON). The unfurl was merging every yAxes entry into one events-timeseries request and inheriting a chartType from any later entry that defined one, so the rendered chart mixed series from all charts and could adopt the second chart's style (e.g. area) instead of the first chart's default. Take yAxes and chartType from only the first aggregateField that has yAxes so the unfurl renders the first chart, matching what the Explore page shows at the top. Group-bys still accumulate since they apply to the shared query rather than to a specific chart. Apply the same change to the metric JSON's nested aggregateFields. Fixes DAIN-1551
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 72d8eb7. Configure here.
The bug lives in map_explore_query_args, so drop the mocked unfurl execution and assert only on the link-matched args.
Switch to the real URL from DAIN-1551 (count first with chartType=2, avg second). Pre-fix behavior: both yAxes merged into the API request, which is why avg was visible in Slack alongside count's area chart.
A prior refactor narrowed the try/except around json.loads so that subsequent parsed.get() / "in" parsed usage ran outside the handler. json.loads can return non-dict values (int, list, string, null) which then raise TypeError or AttributeError and crash the arg mapper. Move the usage back inside the try and also catch AttributeError, so non-dict JSON is silently skipped (falling back to the dataset default yAxis) and add a regression test.
edwardgou-sentry
approved these changes
Apr 17, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Url unfurls currently only supports one chart, this fixes a bug when multiple charts are present, we display the last chart instead of the first.
Ai comment
Explore URLs can contain multiple
aggregateFieldentries, each of which maps to a separate chart in the Explore UI (perVisualize.fromJSONinstatic/app/views/explore/contexts/pageParamsContext/visualizes.tsx). The Slack unfurl was merging everyyAxesentry into oneevents-timeseriesrequest and inheriting achartTypefrom any later entry that defined one, so the rendered chart mixed series from all charts and could adopt the second chart's style (e.g. area) instead of the first chart's default.Example URL from the issue — three
aggregateFieldentries (empty groupBy,avg(span.duration), thencount(span.duration)withchartType: 2): the unfurl was sending both yAxes to the API and rendering as area, when it should show just the first chart (avg(span.duration)as a line).Take
yAxesandchartTypefrom only the firstaggregateFieldthat hasyAxesso the unfurl matches the top-most chart on the Explore page. Group-bys still accumulate since they apply to the shared query rather than to a specific chart. Applied the same change to the metric JSON's nestedaggregateFields.Fixes DAIN-1551