From 18d906390ff1892e70687e2498a6138ca62ca3f0 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 8 Feb 2023 18:08:26 +0100 Subject: [PATCH] [HttpClient] Fix data collector --- DataCollector/HttpClientDataCollector.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DataCollector/HttpClientDataCollector.php b/DataCollector/HttpClientDataCollector.php index edd9d1c..1925786 100644 --- a/DataCollector/HttpClientDataCollector.php +++ b/DataCollector/HttpClientDataCollector.php @@ -43,8 +43,8 @@ public function collect(Request $request, Response $response, \Throwable $except public function lateCollect() { - $this->data['request_count'] = 0; - $this->data['error_count'] = 0; + $this->data['request_count'] = $this->data['request_count'] ?? 0; + $this->data['error_count'] = $this->data['error_count'] ?? 0; $this->data += ['clients' => []]; foreach ($this->clients as $name => $client) { @@ -59,7 +59,8 @@ public function lateCollect() $this->data['clients'][$name]['traces'] = array_merge($this->data['clients'][$name]['traces'], $traces); $this->data['request_count'] += \count($traces); - $this->data['error_count'] += $this->data['clients'][$name]['error_count'] += $errorCount; + $this->data['error_count'] += $errorCount; + $this->data['clients'][$name]['error_count'] += $errorCount; $client->reset(); }