diff --git a/src/Sentry/Laravel/Tracing/EventHandler.php b/src/Sentry/Laravel/Tracing/EventHandler.php index b184ca82..cb9a86cb 100644 --- a/src/Sentry/Laravel/Tracing/EventHandler.php +++ b/src/Sentry/Laravel/Tracing/EventHandler.php @@ -170,9 +170,7 @@ protected function queryExecutedHandler(DatabaseEvents\QueryExecuted $query): vo $queryOrigin = $this->resolveQueryOriginFromBacktrace(); if ($queryOrigin !== null) { - $context->setData(array_merge($context->getData(), [ - 'db.sql.origin' => $queryOrigin - ])); + $context->setData(array_merge($context->getData(), $queryOrigin)); } } @@ -184,7 +182,7 @@ protected function queryExecutedHandler(DatabaseEvents\QueryExecuted $query): vo * * @return string|null */ - private function resolveQueryOriginFromBacktrace(): ?string + private function resolveQueryOriginFromBacktrace(): ?array { $backtraceHelper = $this->makeBacktraceHelper(); @@ -196,7 +194,11 @@ private function resolveQueryOriginFromBacktrace(): ?string $filePath = $backtraceHelper->getOriginalViewPathForFrameOfCompiledViewPath($firstAppFrame) ?? $firstAppFrame->getFile(); - return "{$filePath}:{$firstAppFrame->getLine()}"; + return [ + 'code.filepath' => $filePath, + 'code.function' => $firstAppFrame->getFunctionName(), + 'code.lineno' => $firstAppFrame->getLine(), + ]; } protected function responsePreparedHandler(RoutingEvents\ResponsePrepared $event): void