File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
dev-packages/node-integration-tests/suites/tracing/kafkajs Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,27 @@ describe('kafkajs', () => {
2727 transaction : ( transaction : TransactionEvent ) => {
2828 receivedTransactions . push ( transaction ) ;
2929
30- const producer = receivedTransactions . find ( t => t . transaction === 'send test-topic' ) ;
31- const consumer = receivedTransactions . find ( t => t . transaction === 'process test-topic' ) ;
30+ const producer = receivedTransactions . find (
31+ t => t . contexts ?. trace ?. data ?. [ 'sentry.origin' ] === 'auto.kafkajs.otel.producer' ,
32+ ) ;
33+ const consumer = receivedTransactions . find (
34+ t => t . contexts ?. trace ?. data ?. [ 'sentry.origin' ] === 'auto.kafkajs.otel.consumer' ,
35+ ) ;
3236
3337 expect ( producer ) . toBeDefined ( ) ;
3438 expect ( consumer ) . toBeDefined ( ) ;
3539
40+ for ( const t of [ producer , consumer ] ) {
41+ // just to assert on the basic shape (for more straight-forward tests, this is usually done by the runner)
42+ expect ( t ) . toMatchObject ( {
43+ event_id : expect . any ( String ) ,
44+ timestamp : expect . anything ( ) ,
45+ start_timestamp : expect . anything ( ) ,
46+ spans : expect . any ( Array ) ,
47+ type : 'transaction' ,
48+ } ) ;
49+ }
50+
3651 expect ( producer ! . contexts ?. trace ) . toMatchObject (
3752 expect . objectContaining ( {
3853 op : 'message' ,
You can’t perform that action at this time.
0 commit comments