11import { getActiveDomain , getMainCarrier , Hub } from '@sentry/hub' ;
2- import { CustomSampleContext , SampleContext , TransactionContext } from '@sentry/types' ;
2+ import { CustomSamplingContext , SamplingContext , TransactionContext } from '@sentry/types' ;
33import {
44 dynamicRequire ,
55 extractNodeRequestData ,
@@ -48,11 +48,11 @@ function _inheritOrUseGivenRate(parentSampled: boolean | undefined, givenRate: u
4848 *
4949 * @param hub: The hub off of which to read config options
5050 * @param transaction: The transaction needing a sampling decision
51- * @param sampleContext : Default and user-provided data which may be used to help make the decision
51+ * @param samplingContext : Default and user-provided data which may be used to help make the decision
5252 *
5353 * @returns The given transaction with its `sampled` value set
5454 */
55- function sample < T extends Transaction > ( hub : Hub , transaction : T , sampleContext : SampleContext = { } ) : T {
55+ function sample < T extends Transaction > ( hub : Hub , transaction : T , samplingContext : SamplingContext = { } ) : T {
5656 const client = hub . getClient ( ) ;
5757 const options = ( client && client . getOptions ( ) ) || { } ;
5858
@@ -66,8 +66,8 @@ function sample<T extends Transaction>(hub: Hub, transaction: T, sampleContext:
6666 // work; prefer the hook if so
6767 const sampleRate =
6868 typeof options . tracesSampler === 'function'
69- ? options . tracesSampler ( sampleContext )
70- : _inheritOrUseGivenRate ( sampleContext . parentSampled , options . tracesSampleRate ) ;
69+ ? options . tracesSampler ( samplingContext )
70+ : _inheritOrUseGivenRate ( samplingContext . parentSampled , options . tracesSampleRate ) ;
7171
7272 // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
7373 // only valid values are booleans or numbers between 0 and 1.)
@@ -116,12 +116,12 @@ function sample<T extends Transaction>(hub: Hub, transaction: T, sampleContext:
116116 *
117117 * @returns The default sample context
118118 */
119- function getDefaultSampleContext < T extends Transaction > ( transaction : T ) : SampleContext {
120- const defaultSampleContext : SampleContext = { } ;
119+ function getDefaultSamplingContext < T extends Transaction > ( transaction : T ) : SamplingContext {
120+ const defaultSamplingContext : SamplingContext = { } ;
121121
122122 // include parent's sampling decision, if there is one
123123 if ( transaction . parentSpanId && transaction . sampled !== undefined ) {
124- defaultSampleContext . parentSampled = transaction . sampled ;
124+ defaultSamplingContext . parentSampled = transaction . sampled ;
125125 }
126126
127127 if ( isNodeEnv ( ) ) {
@@ -142,7 +142,7 @@ function getDefaultSampleContext<T extends Transaction>(transaction: T): SampleC
142142 const request = domain . members . find ( ( member : any ) => isInstanceOf ( member , requestType ) ) ;
143143
144144 if ( request ) {
145- defaultSampleContext . request = extractNodeRequestData ( request ) ;
145+ defaultSamplingContext . request = extractNodeRequestData ( request ) ;
146146 }
147147 }
148148 }
@@ -154,11 +154,11 @@ function getDefaultSampleContext<T extends Transaction>(transaction: T): SampleC
154154
155155 if ( 'location' in globalObject ) {
156156 // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
157- defaultSampleContext . location = { ...( globalObject as any ) . location } ;
157+ defaultSamplingContext . location = { ...( globalObject as any ) . location } ;
158158 }
159159 }
160160
161- return defaultSampleContext ;
161+ return defaultSamplingContext ;
162162}
163163
164164/**
@@ -197,10 +197,10 @@ function isValidSampleRate(rate: unknown): boolean {
197197function _startTransaction (
198198 this : Hub ,
199199 context : TransactionContext ,
200- customSampleContext ?: CustomSampleContext ,
200+ customSamplingContext ?: CustomSamplingContext ,
201201) : Transaction {
202202 const transaction = new Transaction ( context , this ) ;
203- return sample ( this , transaction , { ...getDefaultSampleContext ( transaction ) , ...customSampleContext } ) ;
203+ return sample ( this , transaction , { ...getDefaultSamplingContext ( transaction ) , ...customSamplingContext } ) ;
204204}
205205
206206/**
@@ -213,7 +213,7 @@ export function startIdleTransaction(
213213 onScope ?: boolean ,
214214) : IdleTransaction {
215215 const transaction = new IdleTransaction ( context , hub , idleTimeout , onScope ) ;
216- return sample ( hub , transaction , getDefaultSampleContext ( transaction ) ) ;
216+ return sample ( hub , transaction , getDefaultSamplingContext ( transaction ) ) ;
217217}
218218
219219/**
0 commit comments