[Performance] How to trace Prisma down to the SQL query level? #9286
Answered
by
AbhiPrasad
danthareja
asked this question in
Q&A
ContextI'd like to use Sentry to measure the performance impact of Prisma's decision to not use native JOINS for relational databases. Here's what they currently do: Prisma Client: const usersWithPosts = await prisma.user.findMany({
include: {
posts: true,
},
})Resulting SQL: SELECT "public"."User"."id", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1
SELECT "public"."Post"."id", "public"."Post"."title", "public"."Post"."authorId" FROM "public"."Post" WHERE "public"."Post"."authorId" IN ($1,$2,$3,$4) OFFSET $5DescriptionToday, I'd love to be able to see each SQL call in it's own span. ResourcesPrisma provides it's own Open Telementry tracing which exposes these details. Is it possible to hook this into Sentry? |
Answered by
AbhiPrasad
Oct 17, 2023
Replies: 1 comment 3 replies
|
Hey, thanks for writing in! I explored this a little with #5780, and Prisma is a bit of a black box, so OTEL is the way to go here. We have some docs about OpenTelemetry instrumentation with Sentry performance, but we're also working on improving this workflow as part of #8534. |
3 replies
Answer selected by
danthareja
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Hey, thanks for writing in! I explored this a little with #5780, and Prisma is a bit of a black box, so OTEL is the way to go here.
We have some docs about OpenTelemetry instrumentation with Sentry performance, but we're also working on improving this workflow as part of #8534.