Skip to content

Commit a1fddb2

Browse files
authored
Unify backtrace origin (#803)
1 parent a5120cc commit a1fddb2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Sentry/Laravel/Tracing/EventHandler.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ protected function queryExecutedHandler(DatabaseEvents\QueryExecuted $query): vo
170170
$queryOrigin = $this->resolveQueryOriginFromBacktrace();
171171

172172
if ($queryOrigin !== null) {
173-
$context->setData(array_merge($context->getData(), [
174-
'db.sql.origin' => $queryOrigin
175-
]));
173+
$context->setData(array_merge($context->getData(), $queryOrigin));
176174
}
177175
}
178176

@@ -184,7 +182,7 @@ protected function queryExecutedHandler(DatabaseEvents\QueryExecuted $query): vo
184182
*
185183
* @return string|null
186184
*/
187-
private function resolveQueryOriginFromBacktrace(): ?string
185+
private function resolveQueryOriginFromBacktrace(): ?array
188186
{
189187
$backtraceHelper = $this->makeBacktraceHelper();
190188

@@ -196,7 +194,11 @@ private function resolveQueryOriginFromBacktrace(): ?string
196194

197195
$filePath = $backtraceHelper->getOriginalViewPathForFrameOfCompiledViewPath($firstAppFrame) ?? $firstAppFrame->getFile();
198196

199-
return "{$filePath}:{$firstAppFrame->getLine()}";
197+
return [
198+
'code.filepath' => $filePath,
199+
'code.function' => $firstAppFrame->getFunctionName(),
200+
'code.lineno' => $firstAppFrame->getLine(),
201+
];
200202
}
201203

202204
protected function responsePreparedHandler(RoutingEvents\ResponsePrepared $event): void

0 commit comments

Comments
 (0)