11import { getActiveDomain , getMainCarrier , Hub } from '@sentry/hub' ;
2- import { CustomSamplingContext , SamplingContext , TransactionContext } from '@sentry/types' ;
2+ import { CustomSamplingContext , SamplingContext , TransactionContext , TransactionSamplingMethod } from '@sentry/types' ;
33import {
44 dynamicRequire ,
55 extractNodeRequestData ,
@@ -52,7 +52,7 @@ function sample<T extends Transaction>(hub: Hub, transaction: T, samplingContext
5252
5353 // if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that
5454 if ( transaction . sampled !== undefined ) {
55- transaction . tags = { ...transaction . tags , __sentry_samplingMethod : 'explicitly_set' } ;
55+ transaction . tags = { ...transaction . tags , __sentry_samplingMethod : TransactionSamplingMethod . Explicit } ;
5656 return transaction ;
5757 }
5858
@@ -64,18 +64,20 @@ function sample<T extends Transaction>(hub: Hub, transaction: T, samplingContext
6464 // cast the rate to a number first in case it's a boolean
6565 transaction . tags = {
6666 ...transaction . tags ,
67- __sentry_samplingMethod : 'client_sampler' ,
67+ __sentry_samplingMethod : TransactionSamplingMethod . Sampler ,
68+ // TODO kmclb - once tag types are loosened, don't need to cast to string here
6869 __sentry_sampleRate : String ( Number ( sampleRate ) ) ,
6970 } ;
7071 } else if ( samplingContext . parentSampled !== undefined ) {
7172 sampleRate = samplingContext . parentSampled ;
72- transaction . tags = { ...transaction . tags , __sentry_samplingMethod : 'inheritance' } ;
73+ transaction . tags = { ...transaction . tags , __sentry_samplingMethod : TransactionSamplingMethod . Inheritance } ;
7374 } else {
7475 sampleRate = options . tracesSampleRate ;
7576 // cast the rate to a number first in case it's a boolean
7677 transaction . tags = {
7778 ...transaction . tags ,
78- __sentry_samplingMethod : 'client_rate' ,
79+ __sentry_samplingMethod : TransactionSamplingMethod . Rate ,
80+ // TODO kmclb - once tag types are loosened, don't need to cast to string here
7981 __sentry_sampleRate : String ( Number ( sampleRate ) ) ,
8082 } ;
8183 }
0 commit comments