Skip to content

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented Aug 22, 2025

Summary

Should say 'open in explore' and link to the correct logs page

Screenshots

Screenshot 2025-08-22 at 12 03 12 PM

Should say 'open in explore' and link to the correct logs page
@k-fish k-fish requested a review from a team as a code owner August 22, 2025 16:56
Copy link

linear bot commented Aug 22, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 22, 2025
interval: queryParams.interval,
mode: queryParams.mode,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Incorrect Parameter Types and Missing Sort

When calling getLogsUrl, the aggregateFields parameter receives queryParams.visualize, which is an array of visualization objects, instead of the expected array of aggregate field strings. This type mismatch may cause incorrect logs URLs. Additionally, the sort parameter from queryParams is omitted, leading to lost sorting functionality.

Fix in Cursor Fix in Web

Comment on lines +158 to 174
const traceItemDataset = getTraceItemDatasetFromWidgetType(widget.widgetType);

if (widget.queries.length > 1) {
if (traceItemDataset === TraceItemDataset.LOGS) {
Sentry.captureException(
new Error(
`getWidgetExploreUrl: multiple queries for logs is unsupported, widget_id: ${widget.id}, organization_id: ${organization.id}, dashboard_id: ${widget.dashboardId}`
)
);
}
return _getWidgetExploreUrlForMultipleQueries(
widget,
dashboardFilters,
selection,
organization
organization,
traceItemDataset
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: Logs widgets with multiple queries incorrectly generate a URL for the traces compare view (/explore/traces/compare/) instead of the logs view, misdirecting users.
  • Description: When a dashboard widget for logs contains multiple queries, the getWidgetExploreUrl function calls _getWidgetExploreUrlForMultipleQueries. This function, in turn, uses getExploreMultiQueryUrl, which is hardcoded to always generate a URL for the traces compare view (/explore/traces/compare/). As a result, clicking 'Open in Explore' on a multi-query logs widget incorrectly navigates the user to the traces comparison tool instead of the logs exploration view, disrupting the user's workflow and leading them to the wrong context.

  • Suggested fix: The _getWidgetExploreUrlForMultipleQueries function should be updated to handle different dataset types. It should check the widget's dataset and call the appropriate URL generation function, such as getLogsUrl for logs widgets, instead of always defaulting to getExploreMultiQueryUrl which is specific to traces.
    severity: 0.65, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +44 to +45
default:
return TraceItemDataset.SPANS; // Default to spans for backwards compatibility
Copy link
Member

Choose a reason for hiding this comment

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

nit: Can we force the caller to handle the backwards compatibility with widgetType ?? WidgetType.SPANS? and throw an error here? This feels like we're likely to introduce subtle bugs in the future.

@k-fish k-fish merged commit 2ab4104 into master Aug 25, 2025
46 checks passed
@k-fish k-fish deleted the fix/ourlogs/logs-308/log-based-widget-explore branch August 25, 2025 12:03
lzhao-sentry pushed a commit that referenced this pull request Aug 25, 2025
### Summary
Should say 'open in explore' and link to the correct logs page

#### Screenshots
<img width="1145" height="555" alt="Screenshot 2025-08-22 at 12 03
12 PM"
src="https://github.com/user-attachments/assets/1750a00f-7022-4dcc-ba25-115958958776"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants