Skip to content

fix(mcp): Keep N+1 evidence for performance issues detected from spans - #2468

Merged
BYK merged 1 commit into
getsentry:mainfrom
pcbeingused33:fix/n1-generic-evidence
Dec 1, 2026
Merged

BYK merged 1 commit into
getsentry:mainfrom
pcbeingused33:fix/n1-generic-evidence

Conversation

@pcbeingused33

Copy link
Copy Markdown
Contributor

Fixes #2467

get_issue_details dropped the N+1 detector evidence for performance issues that Sentry detects from spans. Those issues are saved as generic events, and mapPerformance returned null unless event.type === "transaction", so the transaction, parent span, repeat count and offending span IDs never reached the response.

Fix

  • mapPerformance also accepts generic events whose occurrence maps to a performance_* issue type. Other generic occurrences (metric alerts, regressions) still leave performance null.
  • selectN1EvidenceSpans now falls back to the offending span IDs when there is no trace data and no spans entry on the event, as its doc comment already describes. Before, it returned an empty list.

Tests

  • issue-event-payload.test.ts: a generic event with a 1006 occurrence keeps issue type, transaction name, parent operation, repeat count and the offending spans; a generic 8001 occurrence keeps performance null.
  • formatting.test.ts: selectN1EvidenceSpans without trace or spans returns the offending span IDs.

Both new tests fail on main and pass with the change; the full mcp-core suite passes.

This pull request was prepared with AI assistance (Claude Code) and has not been reviewed line by line by a human.

Span-detected performance issues are saved as generic events, so
mapPerformance returned null for them and the detector evidence
(transaction, parent span, repeat count, offending span IDs) was lost.
Accept generic events whose occurrence is a performance issue type, and
make selectN1EvidenceSpans fall back to the offending span IDs when the
event has no spans entry and no trace was fetched.

Fixes getsentry#2467

Co-Authored-By: Claude Code <noreply@anthropic.com>
@pcbeingused33
pcbeingused33 requested a review from a team as a code owner November 23, 2026 05:01
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

@pcbeingused333 is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 23, 2026 05:01 Inactive
@vercel

vercel Bot commented Nov 23, 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 Nov 23, 2026 5:01am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 3 days. It closes in 2 days unless someone pushes, comments, or adds the WIP label.

@github-actions github-actions Bot added the Stale label Nov 26, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closed after 5 days with no activity. Reopen it to keep going.

@github-actions github-actions Bot closed this Dec 1, 2026
@BYK BYK reopened this Dec 1, 2026

@sentry-junior sentry-junior 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.

Looks good to me. The premise holds against Sentry source: span-detected N+1 issues go through the issue platform and the occurrence consumer saves them as type: "generic", so the old event.type !== "transaction" guard in mapPerformance dropped their evidence. Gating generic events on a performance_* issue type keeps metric alerts and other generic occurrences out. The trace is already fetched for generic events, so the trace-based span tree still applies when it's available.

The selectN1EvidenceSpans change makes the function match its doc comment (fall back to the offending span IDs). It also changes transaction events with no spans entry and no matching trace spans from an empty list to offender stubs, which looks like the intended behavior.

Both new tests fail without the change and pass with it.

@BYK
BYK enabled auto-merge December 1, 2026 16:50
@BYK
BYK added this pull request to the merge queue Dec 1, 2026
Merged via the queue into getsentry:main with commit d72f042 Dec 1, 2026
27 of 28 checks passed

This branch was previously deployed

2 inactive deployments
Actions — 364e5e8c Deployed Dec 1, 2026 by BYK via eval #2133
Preview – sentry-local — 364e5e8c Deployed Nov 23, 2026 by vercel[bot]
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue details drop N+1 evidence for performance issues detected from spans (generic events)

2 participants