Skip to content

Commit 45bc121

Browse files
guandenghuangdijia
authored andcommitted
optimize(telescope): refine GuzzleHttpClientAspect client request recording (#1044)
* optimize(telescope): refine GuzzleHttpClientAspect client request recording * change duration calculation to use floor instead of round in GuzzleHttpClientAspect * refactor(telescope): streamline response handling in GuzzleHttpClientAspect
1 parent ad3b562 commit 45bc121

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/telescope/src/Aspect/GuzzleHttpClientAspect.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)
6868
'method' => $request->getMethod(),
6969
'uri' => $request->getUri()->__toString(),
7070
'headers' => $request->getHeaders(),
71-
'duration' => $stats->getTransferTime() * 1000,
71+
'duration' => floor(($stats->getTransferTime() ?? 0) * 1000),
7272
];
73-
74-
if ($response = $stats->getResponse()) {
73+
if ($response) {
7574
$content['response_status'] = $response->getStatusCode();
7675
$content['response_headers'] = $response->getHeaders();
7776
$content['response_reason'] = $response->getReasonPhrase();
78-
$content['response_payload'] = $this->getResponsePayload($response, $options);
77+
$content['response'] = $this->getResponsePayload($response, $options);
7978
}
8079

8180
Telescope::recordClientRequest(IncomingEntry::make($content));

0 commit comments

Comments
 (0)