From d2d684dfeebaac38472853bd6cda678052d90b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ShaoBo=20Wan=28=E7=84=A1=E5=B0=98=29?= <756684177@qq.com> Date: Thu, 28 Apr 2022 19:53:54 +0800 Subject: [PATCH] =?UTF-8?q?sql=E9=93=BE=E8=B7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Arms.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Arms.php b/src/Arms.php index 4f18a9d..b7bfee2 100644 --- a/src/Arms.php +++ b/src/Arms.php @@ -10,6 +10,7 @@ use Zipkin\Endpoint; use Workerman\Timer; use support\Db; +use const Zipkin\Tags\SQL_QUERY; class Arms implements MiddlewareInterface { @@ -58,7 +59,11 @@ public function process(Request $request, callable $next): Response $logs = \think\facade\Db::getDbLog(true); if (!empty($logs['sql'])) { foreach ($logs['sql'] as $sql) { - $rootSpan->tag('db.statement', $sql); + $sqlSpan = $tracer->newChild($rootSpan->getContext()); + $sqlSpan->setName(SQL_QUERY); + $sqlSpan->start(); + $sqlSpan->tag('db.statement', $sql); + $sqlSpan->finish(); } } }