sentry-javascript
sentry-javascript copied to clipboard
Prisma Spans don't include SQL
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_expenseWHERE
expenses_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_expenseWHERE
expenses_expense.id = %s