Skip to content

Commit 13a2925

Browse files
committed
fix: refactor carrier initialization in AsyncQueueJobMessageAspect for improved readability
1 parent 6ce9e11 commit 13a2925

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Tracing/Aspect/AsyncQueueJobMessageAspect.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,17 @@ public function handlePush(ProceedingJoinPoint $proceedingJoinPoint)
9494

9595
return trace(
9696
function (Scope $scope) use ($proceedingJoinPoint, $messageId, $destinationName, $bodySize) {
97-
if ($span = $scope->getSpan()) {
98-
$carrier = Carrier::fromSpan($span);
99-
} else {
100-
$carrier = Carrier::fromArray([]);
101-
}
102-
103-
$carrier->with([
97+
$extra = [
10498
'publish_time' => microtime(true),
10599
'message_id' => $messageId,
106100
'destination_name' => $destinationName,
107101
'body_size' => $bodySize,
108-
]);
102+
];
103+
if ($span = $scope->getSpan()) {
104+
$carrier = Carrier::fromSpan($span)->with($extra);
105+
} else {
106+
$carrier = Carrier::fromArray([])->with($extra);
107+
}
109108

110109
Context::set(Constants::TRACE_CARRIER, $carrier);
111110

0 commit comments

Comments
 (0)