sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Prisma Spans don't include SQL

Open silent1mezzo opened this issue 2 years ago • 0 comments

Problem Statement

Prisma spans show the query type in the description instead of the SQL that was generated (findMany, findUnique, update, etc...)

Other SDKs (Python, Ruby, PHP) for specific frameworks (Django, Rails, Laravel) show the actual SQL that's being generated. Having the SQL makes it easy to see what's happening under the hood and solve things like n+1 queries.

Solution Brainstorm

Having the ORM details is useful, especially for finding them in the codebase.

1. Update the span description We could update the span description to include the raw SQL ORM call - raw SQL

e.g. Expense findOne - SELECT expenses_expense.* FROM expenses_expenseWHEREexpenses_expense`.id = %s

2. Update the span op If we wanted to keep it similar to the other SDKs we could have the description as just the raw SQL call and update the Span op to include the ORM call.

span.op: db.prisma.findOne span.description: SELECT expenses_expense.* FROM expenses_expenseWHEREexpenses_expense.id = %s

silent1mezzo avatar Sep 20 '22 11:09 silent1mezzo