Skip to content

Commit

Permalink
Remove client request id from queued job payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
bilfeldt committed Sep 27, 2023
1 parent 768183a commit 99b2eec
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/CorrelationIdServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
class CorrelationIdServiceProvider extends ServiceProvider
{
public const PAYLOAD_KEY_CORRELATION_ID = 'correlation_id';
public const PAYLOAD_KEY_CLIENT_REQUEST_ID = 'client_request_id';

public static function getClientRequestIdHeaderName(): string
{
Expand Down Expand Up @@ -58,10 +57,6 @@ protected function bootQueueCallbacks(): void
$payload['data'][self::PAYLOAD_KEY_CORRELATION_ID] = request()->getCorrelationId();
}

if (! isset($payload['data'][self::PAYLOAD_KEY_CLIENT_REQUEST_ID])) {
$payload['data'][self::PAYLOAD_KEY_CLIENT_REQUEST_ID] = request()->getClientRequestId();
}

return $payload;
});

Expand All @@ -73,15 +68,10 @@ protected function bootQueueCallbacks(): void
$request->headers->set(self::getCorrelationIdHeaderName(), $event->job->payload()['data'][self::PAYLOAD_KEY_CORRELATION_ID] ?? null);
}

if (! $request->header(self::getClientRequestIdHeaderName())) {
$request->headers->set(self::getClientRequestIdHeaderName(), $event->job->payload()['data'][self::PAYLOAD_KEY_CLIENT_REQUEST_ID] ?? null);
}

if (config('correlation-id.queue_context')) {
// Question, can we do this via the middleware instead?
Log::shareContext([
'correlation_id' => $event->job->payload()['data'][self::PAYLOAD_KEY_CORRELATION_ID] ?? null,
'client_request_id' => $event->job->payload()['data'][self::PAYLOAD_KEY_CLIENT_REQUEST_ID] ?? null,
'request_id' => $request->getUniqueId(),
]);
}
Expand Down

0 comments on commit 99b2eec

Please sign in to comment.