@@ -2,7 +2,14 @@ import type { SpanContext } from '@opentelemetry/api';
22import { ROOT_CONTEXT } from '@opentelemetry/api' ;
33import { TraceFlags , context , trace } from '@opentelemetry/api' ;
44import type { SpanProcessor } from '@opentelemetry/sdk-trace-base' ;
5- import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , addBreadcrumb , getClient , setTag , withIsolationScope } from '@sentry/core' ;
5+ import {
6+ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ,
7+ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ,
8+ addBreadcrumb ,
9+ getClient ,
10+ setTag ,
11+ withIsolationScope ,
12+ } from '@sentry/core' ;
613import type { Event , TransactionEvent } from '@sentry/types' ;
714import { logger } from '@sentry/utils' ;
815
@@ -42,9 +49,9 @@ describe('Integration | Transactions', () => {
4249 {
4350 op : 'test op' ,
4451 name : 'test name' ,
45- origin : 'auto.test' ,
4652 attributes : {
4753 [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'task' ,
54+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.test' ,
4855 } ,
4956 } ,
5057 span => {
@@ -185,26 +192,36 @@ describe('Integration | Transactions', () => {
185192 addBreadcrumb ( { message : 'test breadcrumb 1' , timestamp : 123456 } ) ;
186193
187194 withIsolationScope ( ( ) => {
188- startSpan ( { op : 'test op' , name : 'test name' , source : 'task' , origin : 'auto.test' } , span => {
189- addBreadcrumb ( { message : 'test breadcrumb 2' , timestamp : 123456 } ) ;
195+ startSpan (
196+ {
197+ op : 'test op' ,
198+ name : 'test name' ,
199+ source : 'task' ,
200+ attributes : {
201+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.test' ,
202+ } ,
203+ } ,
204+ span => {
205+ addBreadcrumb ( { message : 'test breadcrumb 2' , timestamp : 123456 } ) ;
190206
191- span . setAttributes ( {
192- 'test.outer' : 'test value' ,
193- } ) ;
207+ span . setAttributes ( {
208+ 'test.outer' : 'test value' ,
209+ } ) ;
194210
195- const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
196- subSpan . end ( ) ;
211+ const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
212+ subSpan . end ( ) ;
197213
198- setTag ( 'test.tag' , 'test value' ) ;
214+ setTag ( 'test.tag' , 'test value' ) ;
199215
200- startSpan ( { name : 'inner span 2' } , innerSpan => {
201- addBreadcrumb ( { message : 'test breadcrumb 3' , timestamp : 123456 } ) ;
216+ startSpan ( { name : 'inner span 2' } , innerSpan => {
217+ addBreadcrumb ( { message : 'test breadcrumb 3' , timestamp : 123456 } ) ;
202218
203- innerSpan . setAttributes ( {
204- 'test.inner' : 'test value' ,
219+ innerSpan . setAttributes ( {
220+ 'test.inner' : 'test value' ,
221+ } ) ;
205222 } ) ;
206- } ) ;
207- } ) ;
223+ } ,
224+ ) ;
208225 } ) ;
209226
210227 withIsolationScope ( ( ) => {
@@ -346,12 +363,22 @@ describe('Integration | Transactions', () => {
346363
347364 // We simulate the correct context we'd normally get from the SentryPropagator
348365 context . with ( trace . setSpanContext ( ROOT_CONTEXT , spanContext ) , ( ) => {
349- startSpan ( { op : 'test op' , name : 'test name' , source : 'task' , origin : 'auto.test' } , ( ) => {
350- const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
351- subSpan . end ( ) ;
366+ startSpan (
367+ {
368+ op : 'test op' ,
369+ name : 'test name' ,
370+ source : 'task' ,
371+ attributes : {
372+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.test' ,
373+ } ,
374+ } ,
375+ ( ) => {
376+ const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
377+ subSpan . end ( ) ;
352378
353- startSpan ( { name : 'inner span 2' } , ( ) => { } ) ;
354- } ) ;
379+ startSpan ( { name : 'inner span 2' } , ( ) => { } ) ;
380+ } ,
381+ ) ;
355382 } ) ;
356383
357384 await client . flush ( ) ;
@@ -551,19 +578,29 @@ describe('Integration | Transactions', () => {
551578
552579 // We simulate the correct context we'd normally get from the SentryPropagator
553580 context . with ( trace . setSpanContext ( ROOT_CONTEXT , spanContext ) , ( ) => {
554- startSpan ( { op : 'test op' , name : 'test name' , source : 'task' , origin : 'auto.test' } , span => {
555- expect ( span . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
581+ startSpan (
582+ {
583+ op : 'test op' ,
584+ name : 'test name' ,
585+ source : 'task' ,
586+ attributes : {
587+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'auto.test' ,
588+ } ,
589+ } ,
590+ span => {
591+ expect ( span . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
556592
557- const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
593+ const subSpan = startInactiveSpan ( { name : 'inner span 1' } ) ;
558594
559- expect ( subSpan . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
595+ expect ( subSpan . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
560596
561- subSpan . end ( ) ;
597+ subSpan . end ( ) ;
562598
563- startSpan ( { name : 'inner span 2' } , subSpan => {
564- expect ( subSpan . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
565- } ) ;
566- } ) ;
599+ startSpan ( { name : 'inner span 2' } , subSpan => {
600+ expect ( subSpan . spanContext ( ) . traceState ?. get ( SENTRY_TRACE_STATE_DSC ) ) . toEqual ( dscString ) ;
601+ } ) ;
602+ } ,
603+ ) ;
567604 } ) ;
568605
569606 await client . flush ( ) ;
0 commit comments