1 | <?php |
||
2 | /** |
||
3 | * HTTP Request incoming (server accepted) |
||
4 | * User: moyo |
||
5 | * Date: 23/11/2017 |
||
6 | * Time: 12:17 PM |
||
7 | */ |
||
8 | |||
9 | namespace Carno\HRPC\Handlers; |
||
10 | |||
11 | use Carno\Chain\Layered; |
||
12 | use Carno\Consul\Types\Tagging; |
||
0 ignored issues
–
show
|
|||
13 | use Carno\Coroutine\Context; |
||
14 | use Carno\HRPC\Client\Contracts\Defined; |
||
15 | use Carno\HTTP\Server\Connection; |
||
16 | use Carno\HTTP\Standard\Request as HRequest; |
||
17 | use Carno\RPC\Protocol\Request; |
||
18 | use Carno\Tracing\Contracts\Platform; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Contracts\Platform was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
19 | use Carno\Tracing\Contracts\Vars\EXT; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Contracts\Vars\EXT was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
20 | use Carno\Tracing\Contracts\Vars\FMT; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Contracts\Vars\FMT was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
21 | use Carno\Tracing\Contracts\Vars\TAG; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Contracts\Vars\TAG was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
22 | use Carno\Tracing\Standard\Endpoint; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Standard\Endpoint was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
23 | use Carno\Tracing\Utils\SpansCreator; |
||
0 ignored issues
–
show
The type
Carno\Tracing\Utils\SpansCreator was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
24 | use Throwable; |
||
25 | |||
26 | class TracedIncoming implements Layered |
||
27 | { |
||
28 | use SpansCreator; |
||
29 | |||
30 | /** |
||
31 | * @var Platform |
||
32 | */ |
||
33 | private $platform = null; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $tagged = ''; |
||
39 | |||
40 | /** |
||
41 | * TracedIncoming constructor. |
||
42 | * @param Platform $platform |
||
43 | * @param Tagging $tagging |
||
44 | */ |
||
45 | public function __construct(Platform $platform, Tagging $tagging = null) |
||
46 | { |
||
47 | $this->platform = $platform; |
||
48 | $tagging && $this->tagged = implode(',', $tagging->getTags()); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @param Request $request |
||
53 | * @param Context $ctx |
||
54 | * @return Request |
||
55 | */ |
||
56 | public function inbound($request, Context $ctx) : Request |
||
57 | { |
||
58 | /** |
||
59 | * @var Connection $conn |
||
60 | * @var HRequest $http |
||
61 | */ |
||
62 | $conn = $ctx->get(ServerWrapper::CONNECTION); |
||
63 | $http = $ctx->get(ServerWrapper::REQUESTING); |
||
64 | |||
65 | $this->newSpan( |
||
66 | $ctx, |
||
67 | sprintf('%s.%s', $request->service(), $request->method()), |
||
68 | [ |
||
69 | TAG::SPAN_KIND => TAG::SPAN_KIND_RPC_SERVER, |
||
70 | EXT::LOCAL_ENDPOINT => new Endpoint($request->server(), $conn->local()), |
||
71 | EXT::REMOTE_ENDPOINT => new Endpoint($request->server(), $conn->remote()), |
||
72 | TAG::USER_AGENT => $http->getHeaderLine('User-Agent'), |
||
73 | TAG::CONTENT_TYPE => $http->getHeaderLine('Content-Type'), |
||
74 | TAG::ROUTE_TAGS => $http->getHeaderLine(Defined::X_ROUTE_TAGS), |
||
75 | TAG::ENV_TAGS => $this->tagged, |
||
76 | ], |
||
77 | [ |
||
78 | TAG::HTTP_URL => (string) $http->getUri(), |
||
79 | TAG::HTTP_METHOD => $http->getMethod(), |
||
80 | ], |
||
81 | FMT::HTTP_HEADERS, |
||
82 | $http, |
||
83 | null, |
||
84 | $this->platform |
||
85 | ); |
||
86 | |||
87 | return $request; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @param mixed $message |
||
92 | * @param Context $ctx |
||
93 | * @return mixed |
||
94 | */ |
||
95 | public function outbound($message, Context $ctx) |
||
96 | { |
||
97 | return $message; |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @param Throwable $e |
||
102 | * @param Context $ctx |
||
103 | * @throws Throwable |
||
104 | */ |
||
105 | public function exception(Throwable $e, Context $ctx) : void |
||
106 | { |
||
107 | throw $e; |
||
108 | } |
||
109 | } |
||
110 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths