Skip to content

Commit 07d7f7f

Browse files
DominikB2014claude
andcommitted
fix(slack): Use last yAxis to match QueryDict serialization behavior
QueryDict.items() sends only the last value per key to the API, so charting y_axes[0] produced empty charts when multiple yAxes existed. Use y_axes[-1] to stay consistent with what the API actually receives. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0edf083 commit 07d7f7f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/sentry/integrations/slack/unfurl/explore.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,9 @@ def _unfurl_explore(
158158

159159
group_bys = params.getlist("groupBy")
160160

161-
# Only the first yAxis is charted; multiple charts per unfurl not yet supported
161+
# Only one yAxis is charted; multiple charts per unfurl not yet supported.
162162
if group_bys:
163-
y_axis = y_axes[0]
164-
aggregate_fn = y_axis.split("(")[0]
163+
aggregate_fn = y_axes[-1].split("(")[0]
165164
if aggregate_fn in LINE_PLOT_FIELDS:
166165
style = ChartType.SLACK_DISCOVER_TOP5_PERIOD_LINE
167166
else:
@@ -187,8 +186,11 @@ def _unfurl_explore(
187186
_logger.warning("Failed to load events-timeseries for explore unfurl")
188187
continue
189188

190-
stats = timeseries_to_chart_data(resp.data, y_axes[0], has_groups=bool(group_bys))
191-
chart_data = {"seriesName": y_axes[0], "stats": stats}
189+
# QueryDict.items() sends only the last value per key to the API,
190+
# so we must match that by charting the last yAxis
191+
y_axis = y_axes[-1]
192+
stats = timeseries_to_chart_data(resp.data, y_axis, has_groups=bool(group_bys))
193+
chart_data = {"seriesName": y_axis, "stats": stats}
192194

193195
try:
194196
url = charts.generate_chart(style, chart_data)

0 commit comments

Comments
 (0)