@@ -4,12 +4,8 @@ import type { Transaction } from '@sentry/types';
4
4
import { logger , uuid4 } from '@sentry/utils' ;
5
5
6
6
import { WINDOW } from '../helpers' ;
7
- import type {
8
- JSSelfProfile ,
9
- JSSelfProfiler ,
10
- JSSelfProfilerConstructor ,
11
- } from './jsSelfProfiling' ;
12
- import { addProfileToMap , isValidSampleRate } from './utils' ;
7
+ import type { JSSelfProfile , JSSelfProfiler , JSSelfProfilerConstructor } from './jsSelfProfiling' ;
8
+ import { addProfileToMap , isValidSampleRate } from './utils' ;
13
9
14
10
export const MAX_PROFILE_DURATION_MS = 30_000 ;
15
11
// Keep a flag value to avoid re-initializing the profiler constructor. If it fails
@@ -82,7 +78,12 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact
82
78
83
79
// Prefer sampler to sample rate if both are provided.
84
80
if ( typeof profilesSampler === 'function' ) {
85
- profilesSampleRate = profilesSampler ( { transactionContext : transaction . toContext ( ) } ) ;
81
+ const transactionContext = transaction . toContext ( ) ;
82
+ profilesSampleRate = profilesSampler ( {
83
+ parentSampled : transactionContext . parentSampled ,
84
+ transactionContext : transactionContext ,
85
+ ...transaction . getDynamicSamplingContext ( ) ,
86
+ } ) ;
86
87
}
87
88
88
89
// Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
0 commit comments