Skip to content

Commit 06e1f7e

Browse files
authored
fix(dashboards-comparison): Always pass widget viewer url for all failure types (#95431)
Had a `no_project` failure a couple of runs ago and I had to go hunting for the widget and dashboard through redash. Just adding this in to every sentry message we send back for failures so it's easier to debug.
1 parent 542d3d6 commit 06e1f7e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/sentry/discover/compare_tables.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,19 @@ def compare_tables_for_dashboard_widget_queries(
121121
organization_id=dashboard.organization.id, status=ObjectStatus.ACTIVE
122122
)
123123

124+
widget_viewer_url = (
125+
generate_organization_url(organization.slug)
126+
+ f"/dashboard/{dashboard.id}/widget/{widget.id}/"
127+
)
128+
124129
if len(list(projects)) == 0:
125130
with sentry_sdk.isolation_scope() as scope:
126131
scope.set_tag("passed", False)
127132
scope.set_tag("failed_reason", CompareTableResult.NO_PROJECT.value)
133+
scope.set_tag(
134+
"widget_viewer_url",
135+
widget_viewer_url,
136+
)
128137
sentry_sdk.capture_message(
129138
"dashboard_widget_comparison_done", level="info", scope=scope
130139
)
@@ -143,6 +152,10 @@ def compare_tables_for_dashboard_widget_queries(
143152
scope.set_tag("passed", False)
144153
scope.set_tag("failed_reason", CompareTableResult.NO_FIELDS.value)
145154
scope.set_tag("widget_fields", fields)
155+
scope.set_tag(
156+
"widget_viewer_url",
157+
widget_viewer_url,
158+
)
146159
sentry_sdk.capture_message(
147160
"dashboard_widget_comparison_done", level="info", scope=scope
148161
)
@@ -224,11 +237,6 @@ def compare_tables_for_dashboard_widget_queries(
224237
logger.info("EAP query failed: %s", e)
225238
has_eap_error = True
226239

227-
widget_viewer_url = (
228-
generate_organization_url(organization.slug)
229-
+ f"/dashboard/{dashboard.id}/widget/{widget.id}/"
230-
)
231-
232240
if has_metrics_error and has_eap_error:
233241
with sentry_sdk.isolation_scope() as scope:
234242
scope.set_tag("passed", False)

0 commit comments

Comments
 (0)