Skip to content

Commit 5bcf510

Browse files
DominikB2014claude
andcommitted
fix(slack): Include y-axis aggregate in Explore unfurl title
The unfurl title now includes the aggregates being plotted, e.g. "Explore Traces - avg(span.duration)" or "Explore Logs - count(message)" instead of just "Explore Traces". This matches the Explore page and helps users understand what's being charted at a glance. Fixes DAIN-1489 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2940df9 commit 5bcf510

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from typing import Any, TypedDict
88
from urllib.parse import urlparse
99

10-
import sentry_sdk
1110
from django.http.request import QueryDict
1211

1312
from sentry import analytics, features
@@ -112,10 +111,6 @@ def _unfurl_explore(
112111
if not org:
113112
continue
114113

115-
sentry_sdk.set_tag("organization.slug", org_slug)
116-
if user:
117-
sentry_sdk.set_tag("user.email", getattr(user, "email", None))
118-
119114
params = link.args["query"]
120115
chart_type = link.args.get("chart_type")
121116

@@ -162,8 +157,10 @@ def _unfurl_explore(
162157
_logger.warning("Failed to generate chart for explore unfurl")
163158
continue
164159

160+
# Only one chart/y-axis is supported at a time in Explore
161+
title = f"{defaults['title']} - {y_axes[0]}"
165162
unfurls[link.url] = SlackDiscoverMessageBuilder(
166-
title=defaults["title"],
163+
title=title,
167164
chart_url=url,
168165
).build()
169166

tests/sentry/integrations/slack/test_unfurl.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,9 @@ def test_unfurl_explore(
15221522

15231523
assert (
15241524
unfurls[url]
1525-
== SlackDiscoverMessageBuilder(title="Explore Traces", chart_url="chart-url").build()
1525+
== SlackDiscoverMessageBuilder(
1526+
title="Explore Traces - avg(span.duration)", chart_url="chart-url"
1527+
).build()
15261528
)
15271529
assert len(mock_generate_chart.mock_calls) == 1
15281530
assert mock_generate_chart.call_args[0][0] == ChartType.SLACK_EXPLORE_LINE
@@ -1695,7 +1697,9 @@ def test_unfurl_explore_end_to_end(
16951697
assert len(unfurls) == 1
16961698
assert (
16971699
unfurls[url]
1698-
== SlackDiscoverMessageBuilder(title="Explore Traces", chart_url="chart-url").build()
1700+
== SlackDiscoverMessageBuilder(
1701+
title="Explore Traces - avg(span.duration)", chart_url="chart-url"
1702+
).build()
16991703
)
17001704

17011705
@patch(
@@ -1806,7 +1810,9 @@ def test_unfurl_explore_logs(
18061810

18071811
assert (
18081812
unfurls[url]
1809-
== SlackDiscoverMessageBuilder(title="Explore Logs", chart_url="chart-url").build()
1813+
== SlackDiscoverMessageBuilder(
1814+
title="Explore Logs - sum(payload_size)", chart_url="chart-url"
1815+
).build()
18101816
)
18111817
assert len(mock_generate_chart.mock_calls) == 1
18121818
chart_data = mock_generate_chart.call_args[0][1]

0 commit comments

Comments
 (0)