Skip to content

Commit 96fe163

Browse files
committed
wip
1 parent 27c0f8f commit 96fe163

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/Tracing/PropagationContext.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ private static function parseTraceparentAndBaggage(string $traceparent, string $
239239

240240
// Store the propagated trace sample rand or generate a new one
241241
if ($samplingContext->has('sample_rand')) {
242-
// TODO check for 1e13 etc.
243242
$context->sampleRand = (float) $samplingContext->get('sample_rand');
244243
} else {
245244
if ($samplingContext->has('sample_rate') && $context->parentSampled !== null) {

src/Tracing/TransactionContext.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,14 @@ private static function parseTraceAndBaggage(string $sentryTrace, string $baggag
205205

206206
// Store the propagated trace sample rand or generate a new one
207207
if ($samplingContext->has('sample_rand')) {
208-
// TODO check for 1e13 etc.
209208
$context->getMetadata()->setSampleRand((float) $samplingContext->get('sample_rand'));
210209
} else {
211210
if ($samplingContext->has('sample_rate') && $context->parentSampled !== null) {
212211
if ($context->parentSampled === true) {
213212
// [0, rate)
214213
$context->getMetadata()->setSampleRand(round(mt_rand(0, mt_getrandmax() - 1) / mt_getrandmax() * (float) $samplingContext->get('sample_rate'), 6));
215214
} else {
216-
// [rate, 1]
215+
// [rate, 1)
217216
$context->getMetadata()->setSampleRand(round(mt_rand(0, mt_getrandmax() - 1) / mt_getrandmax() * (1 - (float) $samplingContext->get('sample_rate')) + (float) $samplingContext->get('sample-rate'), 6));
218217
}
219218
} elseif ($context->parentSampled !== null) {

0 commit comments

Comments
 (0)