Skip to content

Commit

Permalink
fix(perf-issues): Require space in N+1 ext span description (#50994)
Browse files Browse the repository at this point in the history
Continuing the experiment to remove the query parameterization check
from the N+1 DB Query detector, I noticed that as a side effect we
started detecting issues for Mongo N+1s, which isn't appropriate. The
simplest thing we could do: check for a space in the query. (Everything
we care about will definitely have at least one space in it.)

This change is for experimentation (only affects metrics collected and
doesn't affect any actual issue creation yet).

Will add a test if this change graduates to the real N+1 DB detector.
  • Loading branch information
mjq authored Jun 15, 2023
1 parent 459e448 commit 6d95c20
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@ def is_creation_allowed_for_project(self, project: Optional[Project]) -> bool:

def _contains_valid_repeating_query(self, span: Span) -> bool:
# Remove the regular expression check for parameterization, relying on
# the parameterization in span hashing to handle it.
# the parameterization in span hashing to handle it. Make sure we at
# least have a space though, to exclude e.g. MongoDB and Prisma's
# `rawQuery`.
query = span.get("description", None)
return bool(query)
return bool(query) and " " in query


def contains_complete_query(span: Span, is_source: Optional[bool] = False) -> bool:
Expand Down

0 comments on commit 6d95c20

Please sign in to comment.