Skip to content

feat(detectors): Update detection algorithm for MN+1 Experimental Detector #97533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

roggenkemper
Copy link
Member

this pr makes a few changes to the MN+1 Experimental Detector:

  1. it updates the _equivalent method to differentiate between spans that have the "default" op , which is common in Prisma. This made some detected issues be slightly off because it was finding a "pattern" with two spans that weren't necessarily the same
  2. It updates the definition of a valid pattern to exclude those that start with a serialization span. serialization spans come after a query or operation, so it doesn't make sense to start on them
  3. it keeps more of the most recent spans when leaving the continuing state which should allow for more accurate pattern finding.
    these changes should give more accurate results and fix issues we saw where the pattern was starting/ending 1-2 spans from where we expected it.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 8, 2025
Copy link

codecov bot commented Aug 8, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
27030 1 27029 593
View the top 1 failed test(s) by shortest run time
tests.sentry.performance_issues.experiments.test_m_n_plus_one_db_detector.MNPlusOneDBDetectorTest::test_prisma_ops_with_different_descriptions
Stack Traces | 0.14s run time
#x1B[1m#x1B[.../performance_issues/experiments/test_m_n_plus_one_db_detector.py#x1B[0m:173: in test_prisma_ops_with_different_descriptions
    assert (
#x1B[1m#x1B[31mE   AssertionError: assert 'U' == 'UPDATE users...WHERE id = $3'#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     - UPDATE users SET name = $1, email = $2 WHERE id = $3#x1B[0m
#x1B[1m#x1B[31mE     + U#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

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