Skip to content

feat(search-events): Track assisted query outcome for Seer translations - #1610

Merged
DominikB2014 merged 6 commits into
mainfrom
feat/mcp-assisted-query-outcome
Oct 23, 2026
Merged

DominikB2014 merged 6 commits into
mainfrom
feat/mcp-assisted-query-outcome

Conversation

@DominikB2014

@DominikB2014 DominikB2014 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

When an MCP search tool uses Seer's search agent to turn a natural language question into a query, we now report whether that query returned anything once executed. This lets the assisted query dashboard count MCP alongside the Sentry search bar.

Seer only returns a query, so the frontend's trackAiQueryOutcome never sees MCP runs. The MCP runs the query itself, so it's the only place that knows the result.

What's emitted

A new trackAiQueryOutcome helper sends assisted_query.outcome as a log and a distribution of the result count. It follows the same signature and body as the frontend's trackAiQueryOutcome in static/app/components/searchQueryBuilder/askSeerCombobox/utils.ts (after getsentry/sentry#128561):

  • outcome: has_results, empty_results, or error_on_load (validation or Sentry API failure)
  • referrer: assisted_query.mcp.<dataset>, with spans reported as traces
  • dataset: spans, logs, errors, or tracemetrics (the frontend's names)
  • mode, org_slug, run_id (sentry_run_id), conversation_url, code_mode, cross_event_enabled, error_reason (errors only)
  • result_count on the log only, as the frontend does

Applies to search_traces, search_logs, search_errors, search_metrics, and search_events with those datasets. For time series results, the count is the number of buckets with data.

Not tracked

  • Queries translated by the embedded agent or passed as Sentry syntax, since they say nothing about Seer.
  • Failures while Seer translates the query. Seer already emits those outcomes on its side.

Notes

  • Events go to the MCP server's Sentry project, not the frontend's, so the dashboard needs to include it.

🤖 Generated with Claude Code

When Seer's search agent translates a natural language query, report
whether the executed query returned results via the
`assisted_query.outcome` log and distribution metric, matching
`trackAiQueryOutcome` in Sentry's frontend. The referrer is
`assisted_query.mcp.<dataset>` (spans reported as traces), so the
assisted query dashboard can count MCP alongside the search bar.

Outcomes are `has_results`, `empty_results`, and `error_on_load`.
Translation-time failures are already reported by Seer, and queries
translated by the embedded agent are not tracked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 23, 2026 2:12pm UTC

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1a007c4. Configure here.

Comment thread packages/mcp-core/src/tools/support/search-events/search.ts Outdated
…anslation

Catch errors once around the whole search instead of per API call, so
validation request failures and response shape errors also report
error_on_load. Each run reports at most one outcome.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Match the frontend's trackAiQueryOutcome signature and body: dataset,
mode, organization, resultCount, runId and error, with the referrer
derived from the dataset, error reasons taken from the API detail, and
the log sent through Sentry's logger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use EventsApiDataset and normalizeEventsDataset for the AI query outcome
dataset instead of a Seer-specific copy, and share an ExploreMode type
for the Explore page's samples/aggregate mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry-outcome

# Conflicts:
#	packages/mcp-core/src/tools/support/search-events/seer.ts
@DominikB2014
DominikB2014 requested review from a team October 23, 2026 14:09
@DominikB2014
DominikB2014 marked this pull request as ready for review October 23, 2026 14:12
Keep coverage for the reported attributes, failures after translation,
and skipping embedded agent queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 23, 2026
...timeParams,
});
// A series always has buckets, so count the ones with data.
trackSeerOutcome(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not clear on what's happening here - can we add a bit more explanation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If you request for a series like count(spans), you'll get a series back, but the data for each bucket might be all 0, which means no data.

@DominikB2014
DominikB2014 requested a review from aliu39 October 23, 2026 14:33

@aliu39 aliu39 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!!

@DominikB2014
DominikB2014 merged commit e0b027c into main Oct 23, 2026
36 checks passed
@DominikB2014
DominikB2014 deleted the feat/mcp-assisted-query-outcome branch October 23, 2026 17:56

This branch was successfully deployed

1 active and 1 inactive deployments
Preview — 0c2429f9 Deployed Oct 23, 2026 by vercel[bot]
Actions — 0c2429f9 Deployed Oct 23, 2026 by DominikB2014 via eval #1359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants