@@ -3,6 +3,7 @@ import { isNaN, logger } from '@sentry/utils';
33
44import { DEBUG_BUILD } from '../debug-build' ;
55import { hasTracingEnabled } from '../utils/hasTracingEnabled' ;
6+ import { spanSetMetadata } from '../utils/spanUtils' ;
67import type { Transaction } from './transaction' ;
78
89/**
@@ -29,7 +30,7 @@ export function sampleTransaction<T extends Transaction>(
2930 // if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that
3031 // eslint-disable-next-line deprecation/deprecation
3132 if ( transaction . sampled !== undefined ) {
32- transaction . setMetadata ( {
33+ spanSetMetadata ( transaction , {
3334 // eslint-disable-next-line deprecation/deprecation
3435 sampleRate : Number ( transaction . sampled ) ,
3536 } ) ;
@@ -41,20 +42,20 @@ export function sampleTransaction<T extends Transaction>(
4142 let sampleRate ;
4243 if ( typeof options . tracesSampler === 'function' ) {
4344 sampleRate = options . tracesSampler ( samplingContext ) ;
44- transaction . setMetadata ( {
45+ spanSetMetadata ( transaction , {
4546 sampleRate : Number ( sampleRate ) ,
4647 } ) ;
4748 } else if ( samplingContext . parentSampled !== undefined ) {
4849 sampleRate = samplingContext . parentSampled ;
4950 } else if ( typeof options . tracesSampleRate !== 'undefined' ) {
5051 sampleRate = options . tracesSampleRate ;
51- transaction . setMetadata ( {
52- sampleRate : Number ( sampleRate ) ,
52+ spanSetMetadata ( transaction , {
53+ sampleRate,
5354 } ) ;
5455 } else {
5556 // When `enableTracing === true`, we use a sample rate of 100%
5657 sampleRate = 1 ;
57- transaction . setMetadata ( {
58+ spanSetMetadata ( transaction , {
5859 sampleRate,
5960 } ) ;
6061 }
0 commit comments