From 68f8558f639e6171e7b958e8832d41c30cdf0e14 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 8 Nov 2024 12:47:56 +0100 Subject: [PATCH] Avoid the hook frame in mysqli connection error tracking (#2937) Otherwise the error stems from "Mysqli/MysqliIntegration.php:379" which may be confusing and seemingly hint at a problem in our integrations. --- src/DDTrace/Integrations/Mysqli/MysqliIntegration.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php b/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php index a6a603b7fe..e1b374e725 100644 --- a/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php +++ b/src/DDTrace/Integrations/Mysqli/MysqliIntegration.php @@ -376,7 +376,9 @@ public function trackPotentialError(SpanData $span) { $errorCode = mysqli_connect_errno(); if ($errorCode > 0) { - $span->exception = new \Exception(mysqli_connect_error()); + $span->meta[Tag::ERROR_MSG] = mysqli_connect_error(); + $span->meta[Tag::ERROR_TYPE] = 'mysqli error'; + $span->meta[Tag::ERROR_STACK] = \DDTrace\get_sanitized_exception_trace(new \Exception, 2); } } }