File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -277,13 +277,6 @@ public function startTransaction(TransactionContext $context, array $customSampl
277277 if ($ tracesSampler !== null ) {
278278 $ sampleRate = $ tracesSampler ($ samplingContext );
279279 $ sampleSource = 'config:traces_sampler ' ;
280-
281- $ dynamicSamplingContext = $ context ->getMetadata ()->getDynamicSamplingContext ();
282- if ($ dynamicSamplingContext !== null ) {
283- // If a tracesSampler is defined,
284- // always overwrite the sample_rate in the DSC
285- $ dynamicSamplingContext ->set ('sample_rate ' , (string ) $ sampleRate , true );
286- }
287280 } else {
288281 $ parentSampleRate = $ context ->getMetadata ()->getParentSamplingRate ();
289282 if ($ parentSampleRate !== null ) {
@@ -308,6 +301,12 @@ public function startTransaction(TransactionContext $context, array $customSampl
308301
309302 $ transaction ->getMetadata ()->setSamplingRate ($ sampleRate );
310303
304+ // Always overwrite the sample_rate in the DSC
305+ $ dynamicSamplingContext = $ context ->getMetadata ()->getDynamicSamplingContext ();
306+ if ($ dynamicSamplingContext !== null ) {
307+ $ dynamicSamplingContext ->set ('sample_rate ' , (string ) $ sampleRate , true );
308+ }
309+
311310 if ($ sampleRate === 0.0 ) {
312311 $ transaction ->setSampled (false );
313312
You can’t perform that action at this time.
0 commit comments