Skip to content

fix(issue detectors): Ignore parentless spans in N+1 API calls detector - #123062

Draft
lobsterkatie wants to merge 2 commits into
masterfrom
kmclb-fix-span-similarity-check-in-n-plus-1-api-calls-detector
Draft

fix(issue detectors): Ignore parentless spans in N+1 API calls detector#123062
lobsterkatie wants to merge 2 commits into
masterfrom
kmclb-fix-span-similarity-check-in-n-plus-1-api-calls-detector

Conversation

@lobsterkatie

Copy link
Copy Markdown
Member

This fixes a bug in our N+1 API calls detector, wherein the fact that it's not rejecting parentless spans is causing our "are these two spans similar enough to count as part of a N+1?" check to crash, because it expects a parent span id on both spans.

This fixes that by adding a check for parent span id to the detector's _is_span_eligible method, and declaring as ineligible any span missing one. Because that would have added an extra required line to all of the many test cases for that function, I instead refactored the good span and bad span tests so that the span boilerplate is part of the test function, with only the single good or bad value as the test case. There were also a number of ineligibility reasons which weren't tested, so I added tests cases for those as well.

Fixes https://sentry.sentry.io/issues/7694491240

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant