Skip to content

Commit

Permalink
FRW-8618 added sampling handling on hook end
Browse files Browse the repository at this point in the history
  • Loading branch information
gechetspr committed Aug 22, 2024
1 parent ab7a256 commit 5093925
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ function: \'%s\',
$span->setAttribute(\'error_message\', isset($exception) ? $exception->getMessage() : \'\');
$span->setAttribute(\'error_code\', isset($exception) ? $exception->getCode() : \'\');
$span->setStatus(isset($exception) ? \\OpenTelemetry\\API\\Trace\\StatusCode::STATUS_ERROR : \\OpenTelemetry\\API\\Trace\\StatusCode::STATUS_OK);
$isSampled = $span->getContext()->isSampled();
$thresholdNanos = 10000000;
\ReflectionProperty($span->getContext(), \'isSampled\')->setValue($span->getContext(), $isSampled && $span->getDuration() < $thresholdNano && $span->toSpanData()->getParentSpanId() && $span->toSpanData()->getStatus()->getCode() === \\OpenTelemetry\\API\\Trace\\StatusCode::STATUS_OK);
$span->end();
}
Expand Down

0 comments on commit 5093925

Please sign in to comment.