@@ -305,42 +305,48 @@ test('Sends queue publish spans with `rpc(...)`', async ({ page, baseURL }) => {
305
305
} ) ;
306
306
307
307
test ( 'Sends queue process spans with `schema(...).rpc(...)`' , async ( { page, baseURL } ) => {
308
- const httpTransactionPromise = waitForTransaction ( 'supabase-nextjs' , transactionEvent => {
308
+ const consumerSpanPromise = waitForTransaction ( 'supabase-nextjs' , transactionEvent => {
309
309
return (
310
- transactionEvent ?. contexts ?. trace ?. op === 'http.server' &&
311
- transactionEvent ?. transaction === 'GET /api/queue/consumer-schema'
310
+ transactionEvent ?. contexts ?. trace ?. op === 'queue.process' && transactionEvent ?. transaction === 'supabase.db.rpc'
312
311
) ;
313
312
} ) ;
314
313
315
314
const result = await fetch ( `${ baseURL } /api/queue/consumer-schema` ) ;
316
- const transactionEvent = await httpTransactionPromise ;
315
+ const consumerEvent = await consumerSpanPromise ;
317
316
318
317
expect ( result . status ) . toBe ( 200 ) ;
319
318
expect ( await result . json ( ) ) . toEqual (
320
- expect . objectContaining ( { data : [ expect . objectContaining ( { message : { title : 'Test Todo' } , msg_id : 1 } ) ] } ) ,
319
+ expect . objectContaining ( {
320
+ data : [
321
+ expect . objectContaining ( {
322
+ message : {
323
+ title : 'Test Todo' ,
324
+ } ,
325
+ msg_id : expect . any ( Number ) ,
326
+ } ) ,
327
+ ] ,
328
+ } ) ,
321
329
) ;
322
330
323
- expect ( transactionEvent . spans ) . toHaveLength ( 2 ) ;
324
- expect ( transactionEvent . spans ) . toContainEqual ( {
331
+ expect ( consumerEvent . contexts . trace ) . toEqual ( {
325
332
data : {
326
333
'messaging.destination.name' : 'todos' ,
327
334
'messaging.system' : 'supabase' ,
328
335
'messaging.message.id' : '1' ,
336
+ 'messaging.message.receive.latency' : expect . any ( Number ) ,
329
337
'sentry.op' : 'queue.process' ,
330
338
'sentry.origin' : 'auto.db.supabase' ,
339
+ 'sentry.source' : 'route' ,
331
340
} ,
332
- description : 'supabase.db.rpc' ,
333
341
op : 'queue.process' ,
334
342
origin : 'auto.db.supabase' ,
335
- parent_span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
336
- span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
337
- start_timestamp : expect . any ( Number ) ,
343
+ parent_span_id : expect . any ( String ) ,
344
+ span_id : expect . any ( String ) ,
338
345
status : 'ok' ,
339
- timestamp : expect . any ( Number ) ,
340
- trace_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 32 } / ) ,
346
+ trace_id : expect . any ( String ) ,
341
347
} ) ;
342
348
343
- expect ( transactionEvent . breadcrumbs ) . toContainEqual ( {
349
+ expect ( consumerEvent . breadcrumbs ) . toContainEqual ( {
344
350
timestamp : expect . any ( Number ) ,
345
351
type : 'supabase' ,
346
352
category : 'db.rpc.pop' ,
@@ -353,42 +359,47 @@ test('Sends queue process spans with `schema(...).rpc(...)`', async ({ page, bas
353
359
} ) ;
354
360
355
361
test ( 'Sends queue process spans with `rpc(...)`' , async ( { page, baseURL } ) => {
356
- const httpTransactionPromise = waitForTransaction ( 'supabase-nextjs' , transactionEvent => {
362
+ const consumerSpanPromise = waitForTransaction ( 'supabase-nextjs' , transactionEvent => {
357
363
return (
358
- transactionEvent ?. contexts ?. trace ?. op === 'http.server' &&
359
- transactionEvent ?. transaction === 'GET /api/queue/consumer-rpc'
364
+ transactionEvent ?. contexts ?. trace ?. op === 'queue.process' && transactionEvent ?. transaction === 'supabase.db.rpc'
360
365
) ;
361
366
} ) ;
362
367
363
368
const result = await fetch ( `${ baseURL } /api/queue/consumer-rpc` ) ;
364
- const transactionEvent = await httpTransactionPromise ;
369
+ const consumerEvent = await consumerSpanPromise ;
365
370
366
371
expect ( result . status ) . toBe ( 200 ) ;
367
372
expect ( await result . json ( ) ) . toEqual (
368
- expect . objectContaining ( { data : [ expect . objectContaining ( { message : { title : 'Test Todo' } , msg_id : 2 } ) ] } ) ,
373
+ expect . objectContaining ( {
374
+ data : [
375
+ expect . objectContaining ( {
376
+ message : {
377
+ title : 'Test Todo' ,
378
+ } ,
379
+ msg_id : expect . any ( Number ) ,
380
+ } ) ,
381
+ ] ,
382
+ } ) ,
369
383
) ;
370
-
371
- expect ( transactionEvent . spans ) . toHaveLength ( 2 ) ;
372
- expect ( transactionEvent . spans ) . toContainEqual ( {
384
+ expect ( consumerEvent . contexts . trace ) . toEqual ( {
373
385
data : {
374
386
'messaging.destination.name' : 'todos' ,
375
387
'messaging.system' : 'supabase' ,
376
388
'messaging.message.id' : '2' ,
389
+ 'messaging.message.receive.latency' : expect . any ( Number ) ,
377
390
'sentry.op' : 'queue.process' ,
378
391
'sentry.origin' : 'auto.db.supabase' ,
392
+ 'sentry.source' : 'route' ,
379
393
} ,
380
- description : 'supabase.db.rpc' ,
381
394
op : 'queue.process' ,
382
395
origin : 'auto.db.supabase' ,
383
- parent_span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
384
- span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
385
- start_timestamp : expect . any ( Number ) ,
396
+ parent_span_id : expect . any ( String ) ,
397
+ span_id : expect . any ( String ) ,
386
398
status : 'ok' ,
387
- timestamp : expect . any ( Number ) ,
388
- trace_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 32 } / ) ,
399
+ trace_id : expect . any ( String ) ,
389
400
} ) ;
390
401
391
- expect ( transactionEvent . breadcrumbs ) . toContainEqual ( {
402
+ expect ( consumerEvent . breadcrumbs ) . toContainEqual ( {
392
403
timestamp : expect . any ( Number ) ,
393
404
type : 'supabase' ,
394
405
category : 'db.rpc.pop' ,
@@ -505,41 +516,3 @@ test('Sends queue batch publish spans with `rpc(...)`', async ({ page, baseURL }
505
516
} ,
506
517
} ) ;
507
518
} ) ;
508
-
509
- test ( 'Sends `read` queue operation spans with `rpc(...)`' , async ( { page, baseURL } ) => {
510
- const httpTransactionPromise = waitForTransaction ( 'supabase-nextjs' , transactionEvent => {
511
- return (
512
- transactionEvent ?. contexts ?. trace ?. op === 'http.server' && transactionEvent ?. transaction === 'GET /api/queue/receiver-rpc'
513
- ) ;
514
- } ) ;
515
- const result = await fetch ( `${ baseURL } /api/queue/receiver-rpc` ) ;
516
- const transactionEvent = await httpTransactionPromise ;
517
-
518
- expect ( result . status ) . toBe ( 200 ) ;
519
- expect ( await result . json ( ) ) . toEqual (
520
- expect . objectContaining ( { data : [
521
- expect . objectContaining ( { message : { title : 'Test Todo 1' } , msg_id : 3 } ) ,
522
- expect . objectContaining ( { message : { title : 'Test Todo 2' } , msg_id : 4 } ) ,
523
- ] } ) ,
524
- ) ;
525
-
526
- expect ( transactionEvent . spans ) . toHaveLength ( 2 ) ;
527
- expect ( transactionEvent . spans ) . toContainEqual ( {
528
- data : {
529
- 'messaging.destination.name' : 'todos' ,
530
- 'messaging.system' : 'supabase' ,
531
- 'messaging.message.id' : '3,4' ,
532
- 'sentry.op' : 'queue.receive' ,
533
- 'sentry.origin' : 'auto.db.supabase' ,
534
- } ,
535
- description : 'supabase.db.rpc' ,
536
- op : 'queue.receive' ,
537
- origin : 'auto.db.supabase' ,
538
- parent_span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
539
- span_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 16 } / ) ,
540
- start_timestamp : expect . any ( Number ) ,
541
- status : 'ok' ,
542
- timestamp : expect . any ( Number ) ,
543
- trace_id : expect . stringMatching ( / [ a - f 0 - 9 ] { 32 } / ) ,
544
- } ) ;
545
- } ) ;
0 commit comments