Skip to content

Commit

Permalink
Added method Hyperf\Utils\Network::ip(). (#4284)
Browse files Browse the repository at this point in the history
Co-authored-by: 李铭昕 <715557344@qq.com>
  • Loading branch information
sy-records and limingxinleo authored Nov 23, 2021
1 parent b42c30f commit fb8cad6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Middleware/HttpServerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Hyperf\SwooleTracker\Middleware;

use Hyperf\Contract\ConfigInterface;
use Hyperf\Utils\Network;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand All @@ -34,7 +35,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
{
if (class_exists(Stats::class)) {
$path = $request->getUri()->getPath();
$ip = current(swoole_get_local_ip());
$ip = Network::ip();
$traceId = $request->getHeaderLine('x-swoole-traceid') ?: '';
$spanId = $request->getHeaderLine('x-swoole-spanid') ?: '';

Expand Down

0 comments on commit fb8cad6

Please sign in to comment.