@@ -37,7 +37,6 @@ conditionalTest({ min: 20 })('Prisma ORM v7 Tests', () => {
3737 expect ( spanDescriptions ) . toContain ( 'prisma:client:operation' ) ;
3838 expect ( spanDescriptions ) . toContain ( 'prisma:client:serialize' ) ;
3939 expect ( spanDescriptions ) . toContain ( 'prisma:client:connect' ) ;
40- expect ( spanDescriptions ) . toContain ( 'prisma:client:db_query' ) ;
4140
4241 // Verify the create operation has correct metadata
4342 const createSpan = prismaSpans . find (
@@ -48,11 +47,17 @@ conditionalTest({ min: 20 })('Prisma ORM v7 Tests', () => {
4847 ) ;
4948 expect ( createSpan ) . toBeDefined ( ) ;
5049
51- // Verify db_query span has system info and correct op (v7 uses db.system.name)
52- const dbQuerySpan = prismaSpans . find ( span => span . description === 'prisma:client:db_query' ) ;
50+ // Verify db_query span has system info and correct op (v7 uses db.system.name).
51+ // The SDK should rewrite the span name to the actual SQL text (same as v5/v6
52+ // `prisma:engine:db_query`), so we find it via op/origin rather than description.
53+ const dbQuerySpan = prismaSpans . find (
54+ span => span . data ?. [ 'sentry.op' ] === 'db' && span . data ?. [ 'db.query.text' ] ,
55+ ) ;
56+ expect ( dbQuerySpan ) . toBeDefined ( ) ;
5357 expect ( dbQuerySpan ?. data ?. [ 'db.system.name' ] ) . toBe ( 'postgresql' ) ;
54- expect ( dbQuerySpan ?. data ?. [ 'sentry.op' ] ) . toBe ( 'db' ) ;
5558 expect ( dbQuerySpan ?. op ) . toBe ( 'db' ) ;
59+ expect ( dbQuerySpan ?. description ) . toBe ( dbQuerySpan ?. data ?. [ 'db.query.text' ] ) ;
60+ expect ( dbQuerySpan ?. description ) . not . toBe ( 'prisma:client:db_query' ) ;
5661 } ,
5762 } )
5863 . start ( )
0 commit comments