feat(logs): Wire Seer AI visualization params into logs explore#115585
Conversation
ecd9e6b to
c6d8bea
Compare
📊 Type Coverage Diff✅ no issues found |
c6d8bea to
a1d6489
Compare
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Sorry for the delay - this is new code for me and I wanted to process it for a bit. I think there are some bugs (shoutout Cursor for helping me validate suspicions). And the duplication scares me.
I'm off through EOD Monday but sent this over to the Explore team to see if someone else has more context.
Exciting stuff, really cool to see the visualizations piping through! 🔥
| ? existingVisualizes | ||
| : defaultVisualizes(true).map(visualize => visualize.serialize()); | ||
|
|
||
| return [...groupBys.map(groupBy => ({groupBy})), ...visualizes]; |
There was a problem hiding this comment.
[Bug] Is it intentional that you wanted all group-bys before visualizes?
For context, the old applySeerSearchQuery had a groupByAfterVisualizes pass that detected whether the current list had group-bys positioned after visualizes and preserved that relative order when inserting Seer's new group-bys. This replacement unconditionally puts all group-bys first. So for columns where visualize leads (e.g. [count(message), service.name]), Seer will silently flip the order to [service.name, count(message)] every time it applies a result. Bug?
Was this meant to be checked? 🙂 |
There was a problem hiding this comment.
[Praise] I really appreciate you adding tests for this! (and, you know, extracting a shared testable helper in general)
I haven't reviewed these tests closely because I separately requested more refactoring. But I can if you want.
9859122 to
b8b6a70
Compare
Extract duplicated logic from 5 nearly-identical *SeerComboBox components into reusable hooks in useSeerComboBoxSetup.ts: - useInitialSeerQuery: query construction with FREE_TEXT token filtering - useSelectedProjectIds / useSelectedProjectIdsForMutation: project ID computation - transformSeerResponse: response mapping with snake_case to camelCase conversion - buildSeerDateTimeSelection: UTC date handling and pageFilters fallback Add shared SeerRawResponse and SeerRawResponseItem types to types.ts, replacing per-component response interface declarations. Each component retains its unique domain logic (navigation, field building, visualization handling) while shedding ~400 lines of duplicated boilerplate. Refs #116050 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When applying a Seer query in samples mode, getLogsSeerLocationQuery deleted the logsSortBys param whenever Seer returned an empty sort, wiping the user's existing sort. This diverged from the metrics tab, which preserves the current sortBys when Seer omits a sort. Stop deleting logsSortBys in the samples branch so an empty Seer sort now leaves the existing sort intact. Aggregate-mode behavior is unchanged (an empty sort still resets to the default aggregate sort). Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
The base branch made the SeerExploreQuery interface non-exported, so importing it from seerQuery.ts breaks the typecheck once this branch is merged with its base. Derive the type from getSeerExploreQuery's return type instead, removing the dependency on the export. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
f4c4507 to
4cf7867
Compare
…lization-wiring # Conflicts: # static/app/components/searchQueryBuilder/askSeerCombobox/useSeerComboBoxSetup.spec.tsx # static/app/components/searchQueryBuilder/askSeerCombobox/useSeerComboBoxSetup.ts # static/app/views/discover/results/issueListSeerComboBox.tsx # static/app/views/explore/logs/logsTabSeerComboBox.tsx # static/app/views/explore/metrics/metricsTabSeerComboBox.tsx # static/app/views/explore/seerQuery.spec.tsx # static/app/views/explore/seerQuery.ts # static/app/views/explore/spans/spansTabSeerComboBox.tsx # static/app/views/issueList/issueListSeerComboBox.tsx
Drop the dead getSeerAggregateFields helper, its test, and the orphaned Visualize import. The function was left unused after the merge with master reconciled the spans/metrics callers onto the shared helpers, and knip flags it as an unused export.
Comments were resolved on other PR
Resolve conflict in logsTabSeerComboBox.tsx: keep the PR's Seer visualization wiring (getLogsSeerLocationQuery / getSeerExploreQuery / getSeerWritableAggregateFields / mapSeerResponseItem) and layer in master's project-expansion feature by routing mapSeerResponseItem through buildSeerMutationResult / transformSeerResponse and applying expandedProjectIds to the navigation query, matching the spans combobox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
aliu39
left a comment
There was a problem hiding this comment.
pr description describes what's being done technically in code, but would be nice to have a description of what this enables at the UI/UX level, walking through a user flow using the searchbar. A few screenshots or screen recording to verify changes can also go a long way
| getSeerExploreQuery, | ||
| getSeerSort, | ||
| getSeerWritableAggregateFields, |
There was a problem hiding this comment.
could you add docstrings for these 3 utils?
On input/output fields, different branches/contracts, when to use.. they're hard to review as is
Description updated and here is a video Screen.Recording.2026-06-09.at.4.15.37.PM.mov |
…lization-wiring # Conflicts: # static/app/views/explore/logs/logsTabSeerComboBox.tsx
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 d47180f. Configure here.
Also un-export getRawSeerInterval now that mapSeerResponseItem is its only caller, fixing the knip unused-export failure.

Summary
getLogsSeerLocationQueryandgetLogsSeerAggregateFieldsfrom theLogsTabSeerComboBoxcomponent into testable, reusable helpersWhat this enables (UI/UX)
Previously, asking Seer something like "graph p90 latency by endpoint as a bar chart" in logs explore applied the query filter and group-by, but silently kept the page's existing chart and sort: the visualization payload in Seer's response was discarded, and the sort was parsed but never written to the URL. With this change (plus the companion seer PR https://github.com/getsentry/seer/pull/6513), the requested aggregate, chart type, and sort order are actually applied, and pagination cursors reset so results reflect the new query.
User flow via the logs search bar (Ask Seer):
p90(...)as the y-axis, instead of staying on the defaultcount(message)line chart.-timestamp; sort is routed to the correct query param for the active mode and the stale one is cleared.count(message)visualize rather than rendering blank.Test plan
getLogsSeerLocationQuerycovering samples mode, aggregate mode, group-by ordering, and fallback when Seer omits visualizations