Skip to content

Commit 6ce9e11

Browse files
committed
fix: refactor carrier initialization in AsyncQueueJobMessageAspect for improved clarity
1 parent 3bd62b7 commit 6ce9e11

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/Tracing/Aspect/AsyncQueueJobMessageAspect.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,20 @@ public function handlePush(ProceedingJoinPoint $proceedingJoinPoint)
9595
return trace(
9696
function (Scope $scope) use ($proceedingJoinPoint, $messageId, $destinationName, $bodySize) {
9797
if ($span = $scope->getSpan()) {
98-
$carrier = Carrier::fromSpan($span)->with([
99-
'publish_time' => microtime(true),
100-
'message_id' => $messageId,
101-
'destination_name' => $destinationName,
102-
'body_size' => $bodySize,
103-
]);
104-
105-
Context::set(Constants::TRACE_CARRIER, $carrier);
98+
$carrier = Carrier::fromSpan($span);
99+
} else {
100+
$carrier = Carrier::fromArray([]);
106101
}
107102

103+
$carrier->with([
104+
'publish_time' => microtime(true),
105+
'message_id' => $messageId,
106+
'destination_name' => $destinationName,
107+
'body_size' => $bodySize,
108+
]);
109+
110+
Context::set(Constants::TRACE_CARRIER, $carrier);
111+
108112
return $proceedingJoinPoint->process();
109113
},
110114
SpanContext::make()

0 commit comments

Comments
 (0)