mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-04 12:47:55 +08:00
Add traceId and spanId to SwooleTracker
This commit is contained in:
parent
5a3ea7303c
commit
54e57e4d62
@ -36,8 +36,10 @@ class HttpServerMiddleware implements MiddlewareInterface
|
||||
if (class_exists(Stats::class)) {
|
||||
$path = $request->getUri()->getPath();
|
||||
$ip = current(swoole_get_local_ip());
|
||||
$traceId = $request->getHeaderLine("x-swoole-traceid") ?: "";
|
||||
$spanId = $request->getHeaderLine("x-swoole-spanid") ?: "";
|
||||
|
||||
$tick = Stats::beforeExecRpc($path, $this->name, $ip);
|
||||
$tick = Stats::beforeExecRpc($path, $this->name, $ip, $traceId, $spanId);
|
||||
try {
|
||||
$response = $handler->handle($request);
|
||||
Stats::afterExecRpc($tick, true, $response->getStatusCode());
|
||||
|
Loading…
Reference in New Issue
Block a user