@@ -3,6 +3,7 @@ import { SpanKind } from '@opentelemetry/api';
33import { TraceFlags , context , trace } from '@opentelemetry/api' ;
44import type { ReadableSpan } from '@opentelemetry/sdk-trace-base' ;
55import { Span as SpanClass } from '@opentelemetry/sdk-trace-base' ;
6+ import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '@sentry/core' ;
67import type { PropagationContext } from '@sentry/types' ;
78
89import { getClient } from '../src/custom/hub' ;
@@ -206,7 +207,7 @@ describe('trace', () => {
206207 span => {
207208 expect ( span ) . toBeDefined ( ) ;
208209 expect ( getSpanAttributes ( span ) ) . toEqual ( {
209- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
210+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
210211 } ) ;
211212
212213 expect ( getSpanMetadata ( span ) ) . toEqual ( undefined ) ;
@@ -227,7 +228,7 @@ describe('trace', () => {
227228 [ InternalSentrySemanticAttributes . SOURCE ] : 'task' ,
228229 [ InternalSentrySemanticAttributes . ORIGIN ] : 'auto.test.origin' ,
229230 [ InternalSentrySemanticAttributes . OP ] : 'my-op' ,
230- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
231+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
231232 } ) ;
232233
233234 expect ( getSpanMetadata ( span ) ) . toEqual ( { requestPath : 'test-path' } ) ;
@@ -253,7 +254,7 @@ describe('trace', () => {
253254 expect ( span ) . toBeDefined ( ) ;
254255 expect ( getSpanName ( span ) ) . toEqual ( 'outer' ) ;
255256 expect ( getSpanAttributes ( span ) ) . toEqual ( {
256- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
257+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
257258 test1 : 'test 1' ,
258259 test2 : 2 ,
259260 } ) ;
@@ -326,7 +327,7 @@ describe('trace', () => {
326327
327328 expect ( span ) . toBeDefined ( ) ;
328329 expect ( getSpanAttributes ( span ) ) . toEqual ( {
329- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
330+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
330331 } ) ;
331332
332333 expect ( getSpanMetadata ( span ) ) . toEqual ( undefined ) ;
@@ -341,7 +342,7 @@ describe('trace', () => {
341342
342343 expect ( span2 ) . toBeDefined ( ) ;
343344 expect ( getSpanAttributes ( span2 ) ) . toEqual ( {
344- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
345+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
345346 [ InternalSentrySemanticAttributes . SOURCE ] : 'task' ,
346347 [ InternalSentrySemanticAttributes . ORIGIN ] : 'auto.test.origin' ,
347348 [ InternalSentrySemanticAttributes . OP ] : 'my-op' ,
@@ -366,7 +367,7 @@ describe('trace', () => {
366367 expect ( span ) . toBeDefined ( ) ;
367368 expect ( getSpanName ( span ) ) . toEqual ( 'outer' ) ;
368369 expect ( getSpanAttributes ( span ) ) . toEqual ( {
369- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
370+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
370371 test1 : 'test 1' ,
371372 test2 : 2 ,
372373 } ) ;
@@ -451,7 +452,7 @@ describe('trace', () => {
451452 expect ( span ) . toBeDefined ( ) ;
452453 expect ( getSpanName ( span ) ) . toEqual ( 'outer' ) ;
453454 expect ( getSpanAttributes ( span ) ) . toEqual ( {
454- [ InternalSentrySemanticAttributes . SAMPLE_RATE ] : 1 ,
455+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
455456 test1 : 'test 1' ,
456457 test2 : 2 ,
457458 } ) ;
@@ -688,6 +689,10 @@ describe('trace (sampling)', () => {
688689 expect ( tracesSampler ) . toBeCalledTimes ( 1 ) ;
689690 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
690691 parentSampled : undefined ,
692+ name : 'outer' ,
693+ attributes : {
694+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
695+ } ,
691696 transactionContext : { name : 'outer' , parentSampled : undefined } ,
692697 } ) ;
693698
@@ -705,6 +710,8 @@ describe('trace (sampling)', () => {
705710 expect ( tracesSampler ) . toHaveBeenCalledTimes ( 3 ) ;
706711 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
707712 parentSampled : false ,
713+ name : 'inner2' ,
714+ attributes : { } ,
708715 transactionContext : { name : 'inner2' , parentSampled : false } ,
709716 } ) ;
710717 } ) ;
@@ -727,6 +734,10 @@ describe('trace (sampling)', () => {
727734 expect ( tracesSampler ) . toBeCalledTimes ( 1 ) ;
728735 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
729736 parentSampled : undefined ,
737+ name : 'outer' ,
738+ attributes : {
739+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
740+ } ,
730741 transactionContext : { name : 'outer' , parentSampled : undefined } ,
731742 } ) ;
732743
@@ -744,6 +755,8 @@ describe('trace (sampling)', () => {
744755 expect ( tracesSampler ) . toHaveBeenCalledTimes ( 3 ) ;
745756 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
746757 parentSampled : false ,
758+ name : 'inner2' ,
759+ attributes : { } ,
747760 transactionContext : { name : 'inner2' , parentSampled : false } ,
748761 } ) ;
749762
@@ -757,6 +770,8 @@ describe('trace (sampling)', () => {
757770 expect ( tracesSampler ) . toHaveBeenCalledTimes ( 4 ) ;
758771 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
759772 parentSampled : undefined ,
773+ name : 'outer3' ,
774+ attributes : { } ,
760775 transactionContext : { name : 'outer3' , parentSampled : undefined } ,
761776 } ) ;
762777 } ) ;
@@ -799,6 +814,8 @@ describe('trace (sampling)', () => {
799814 expect ( tracesSampler ) . toBeCalledTimes ( 1 ) ;
800815 expect ( tracesSampler ) . toHaveBeenLastCalledWith ( {
801816 parentSampled : true ,
817+ name : 'outer' ,
818+ attributes : { } ,
802819 transactionContext : {
803820 name : 'outer' ,
804821 parentSampled : true ,
0 commit comments