Skip to content

Commit a3d6b35

Browse files
committed
wip
1 parent a1f8c41 commit a3d6b35

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/State/Hub.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)