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 1
1
<?php
2
- declare (strict_types=1 );
2
+
3
+ declare (strict_types = 1 );
3
4
4
5
namespace Jaeger \Process ;
5
6
6
7
class CliProcess extends AbstractProcess
7
8
{
9
+ public function __construct (string $ serviceName )
10
+ {
11
+ parent ::__construct ($ serviceName , [new ProcessIpTag ()]);
12
+ }
8
13
}
Original file line number Diff line number Diff line change 3
3
4
4
namespace Jaeger \Process ;
5
5
6
- class InternalServerProcess extends AbstractProcess
6
+ class InternalServerProcess extends CliProcess
7
7
{
8
8
}
Original file line number Diff line number Diff line change 1
1
<?php
2
- declare (strict_types=1 );
2
+
3
+ declare (strict_types = 1 );
3
4
4
5
namespace Jaeger \Process ;
5
6
6
7
use Jaeger \Tag \StringTag ;
7
8
8
9
class ProcessIpTag extends StringTag
9
10
{
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
+
10
24
public function __construct ()
11
25
{
12
- parent ::__construct ('ip ' , $ _SERVER [ ' SERVER_ADDR ' ] );
26
+ parent ::__construct ('ip ' , $ this -> getIp () );
13
27
}
14
28
}
You can’t perform that action at this time.
0 commit comments