Skip to content

Commit

Permalink
Change the httpHandler requestId fallback to a hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed Dec 10, 2024
1 parent 7869f8c commit 7d3a494
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/HttpHandler/Guzzle6HttpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __invoke(RequestInterface $request, array $options = [])
$requestEvent->retryAttempt = $options['retryAttempt'] ?? null;
$requestEvent->serviceName = $options['serviceName'] ?? null;
$requestEvent->processId = getmypid();

Check failure on line 70 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis / PHPStan Static Analysis

Property Google\Auth\Logging\RpcLogEvent::$processId (int|null) does not accept int|false.
$requestEvent->requestId = $options['requestId'] ?? spl_object_id($request);
$requestEvent->requestId = $options['requestId'] ?? crc32((string) spl_object_id($request) . getmypid());

$this->logRequest($requestEvent);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public function async(RequestInterface $request, array $options = [])
$requestEvent->retryAttempt = $options['retryAttempt'] ?? null;
$requestEvent->serviceName = $options['serviceName'] ?? null;
$requestEvent->processId = getmypid();

Check failure on line 114 in src/HttpHandler/Guzzle6HttpHandler.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis / PHPStan Static Analysis

Property Google\Auth\Logging\RpcLogEvent::$processId (int|null) does not accept int|false.
$requestEvent->requestId = $options['requestId'] ?? spl_object_id($request);
$requestEvent->requestId = $options['requestId'] ?? crc32((string) spl_object_id($request) . getmypid());

$this->logRequest($requestEvent);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/LoggingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private function logResponse(RpcLogEvent $event): void
$debugEvent = [
'timestamp' => $event->timestamp,
'severity' => strtoupper(LogLevel::DEBUG),
'processId' => $event->processId,
'processId' => $event->processId ?? null,
'requestId' => $event->requestId ?? null,
'jsonPayload' => [
'response.headers' => $event->headers,
Expand Down

0 comments on commit 7d3a494

Please sign in to comment.