Connecting GraphQL Debugger to Prisma
GraphQL Debugger generates Open Telemetry compatible spans, and so does Prisma Tracing, therefore it is possible to connect the two together.
Note Prisma Traces will be marked as
forigen
spans, as they are not part of the GraphQL request.
Prisma Tracing
To enable Prisma Tracing you first need to change the prisma.schema
file to include the tracing preview feature:
generator client {
provider = "prisma-client-js"
previewFeatures = ["tracing"] // <-- add this line
}
Then you can pass in the PrismaInstrumentation
to the traceSchema
method:
import { traceSchema } from "@graphql-debugger/trace-schema";
import { PrismaInstrumentation } from "@prisma/instrumentation";
const tracedSchema = traceSchema({
schema,
instrumentations: [new PrismaInstrumentation()],
});
Doing so will allow you to see each Prisma request that happens inside your resolvers.