File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 11<?php
2- declare (strict_types=1 );
2+
3+ declare (strict_types = 1 );
34
45namespace Jaeger \Process ;
56
67class CliProcess extends AbstractProcess
78{
9+ public function __construct (string $ serviceName )
10+ {
11+ parent ::__construct ($ serviceName , [new ProcessIpTag ()]);
12+ }
813}
Original file line number Diff line number Diff line change 33
44namespace Jaeger \Process ;
55
6- class InternalServerProcess extends AbstractProcess
6+ class InternalServerProcess extends CliProcess
77{
88}
Original file line number Diff line number Diff line change 11<?php
2- declare (strict_types=1 );
2+
3+ declare (strict_types = 1 );
34
45namespace Jaeger \Process ;
56
67use Jaeger \Tag \StringTag ;
78
89class ProcessIpTag extends StringTag
910{
11+ private function getIp (): string
12+ {
13+ if (\array_key_exists ('SERVER_ADDR ' , $ _SERVER ) && '' !== ($ ip = (string )$ _SERVER ['SERVER_ADDR ' ])) {
14+ return $ ip ;
15+ }
16+
17+ if (false === $ hostName = \gethostname ()) {
18+ return '127.0.0.1 ' ;
19+ }
20+
21+ return \gethostbyname ($ hostName );
22+ }
23+
1024 public function __construct ()
1125 {
12- parent ::__construct ('ip ' , $ _SERVER [ ' SERVER_ADDR ' ] );
26+ parent ::__construct ('ip ' , $ this -> getIp () );
1327 }
1428}
You can’t perform that action at this time.
0 commit comments