@@ -13,13 +13,13 @@ |
||
| 13 | 13 | public function allowRequest(Request $request): bool |
| 14 | 14 | { |
| 15 | 15 | if (Config::get('jaravel.http.allow_request')) { |
| 16 | - if (!Caller::call(Config::get('jaravel.http.allow_request'), [$request])) { |
|
| 16 | + if (!Caller::call(Config::get('jaravel.http.allow_request'), [ $request ])) { |
|
| 17 | 17 | return false; |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (Config::get('jaravel.http.deny_request')) { |
| 22 | - if (Caller::call(Config::get('jaravel.http.deny_request'), [$request])) { |
|
| 22 | + if (Caller::call(Config::get('jaravel.http.deny_request'), [ $request ])) { |
|
| 23 | 23 | return false; |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | return $command; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $command->{$tracingContextField} = []; |
|
| 34 | + $command->{$tracingContextField} = [ ]; |
|
| 35 | 35 | $this->tracer->inject($span->getContext(), Formats\TEXT_MAP, $command->{$tracingContextField}); |
| 36 | 36 | |
| 37 | 37 | return $command; |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function allow(): bool |
| 21 | 21 | { |
| 22 | - $filteredCommands = Config::get('jaravel.console.filter_commands', ['schedule:run', 'horizon', 'queue:']); |
|
| 22 | + $filteredCommands = Config::get('jaravel.console.filter_commands', [ 'schedule:run', 'horizon', 'queue:' ]); |
|
| 23 | 23 | |
| 24 | - $command = $this->request->server('argv')[1] ?? ''; |
|
| 24 | + $command = $this->request->server('argv')[ 1 ] ?? ''; |
|
| 25 | 25 | |
| 26 | 26 | return !Str::contains($command, $filteredCommands); |
| 27 | 27 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->tracer = $tracer; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function create(string $operationName, array $carrier = [], ?string $referenceType = null): Span |
|
| 21 | + public function create(string $operationName, array $carrier = [ ], ?string $referenceType = null): Span |
|
| 22 | 22 | { |
| 23 | 23 | return $this->tracer->startActiveSpan( |
| 24 | 24 | $operationName, |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $baseOptions, |
| 42 | 42 | $spanContext ? [ |
| 43 | 43 | 'references' => Reference::create($referenceType, $spanContext), |
| 44 | - ] : [] |
|
| 44 | + ] : [ ] |
|
| 45 | 45 | ); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -17,19 +17,19 @@ |
||
| 17 | 17 | { |
| 18 | 18 | public static function create(): callable |
| 19 | 19 | { |
| 20 | - return function (callable $handler) { |
|
| 21 | - return function (RequestInterface $request, array $options) use ($handler) { |
|
| 20 | + return function(callable $handler) { |
|
| 21 | + return function(RequestInterface $request, array $options) use ($handler) { |
|
| 22 | 22 | /** @var Tracer $tracer */ |
| 23 | 23 | $tracer = App::make(Tracer::class); |
| 24 | 24 | /** @var SpanCreator $spanCreator */ |
| 25 | 25 | $spanCreator = App::make(SpanCreator::class); |
| 26 | 26 | |
| 27 | - $span = $spanCreator->create(Caller::call(Config::get('jaravel.guzzle.span_name'), [$request])); |
|
| 27 | + $span = $spanCreator->create(Caller::call(Config::get('jaravel.guzzle.span_name'), [ $request ])); |
|
| 28 | 28 | |
| 29 | - $headers = []; |
|
| 29 | + $headers = [ ]; |
|
| 30 | 30 | $tracer->inject($span->getContext(), Formats\TEXT_MAP, $headers); |
| 31 | 31 | |
| 32 | - SpanTagHelper::setTags($span, Caller::call(Config::get('jaravel.guzzle.tags'), [$request])); |
|
| 32 | + SpanTagHelper::setTags($span, Caller::call(Config::get('jaravel.guzzle.tags'), [ $request ])); |
|
| 33 | 33 | |
| 34 | 34 | foreach ($headers as $name => $value) { |
| 35 | 35 | $request = $request->withHeader($name, $value); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $this->spanCreator->create( |
| 43 | - Caller::call(Config::get('jaravel.http.span_name'), [$request]), |
|
| 43 | + Caller::call(Config::get('jaravel.http.span_name'), [ $request ]), |
|
| 44 | 44 | iterator_to_array($request->headers), |
| 45 | 45 | Reference::CHILD_OF |
| 46 | 46 | ); |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $callableConfig = Config::get('jaravel.http.tags', fn () => [ |
|
| 64 | + $callableConfig = Config::get('jaravel.http.tags', fn() => [ |
|
| 65 | 65 | 'type' => 'http', |
| 66 | 66 | ]); |
| 67 | 67 | |
| 68 | - SpanTagHelper::setTags($scope->getSpan(), Caller::call($callableConfig, [$request, $response])); |
|
| 68 | + SpanTagHelper::setTags($scope->getSpan(), Caller::call($callableConfig, [ $request, $response ])); |
|
| 69 | 69 | |
| 70 | 70 | $scope->close(); |
| 71 | 71 | $this->tracer->flush(); |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | $spanCreator = App::make(SpanCreator::class); |
| 25 | 25 | |
| 26 | 26 | $tracingContextField = self::JOB_TRACING_CONTEXT_FIELD; |
| 27 | - $payload = $job->{$tracingContextField} ?? []; |
|
| 27 | + $payload = $job->{$tracingContextField} ?? [ ]; |
|
| 28 | 28 | $span = $spanCreator->create( |
| 29 | - Caller::call(Config::get('jaravel.job.span_name'), [$job, $job->job ?? null]), |
|
| 29 | + Caller::call(Config::get('jaravel.job.span_name'), [ $job, $job->job ?? null ]), |
|
| 30 | 30 | $payload, |
| 31 | 31 | Reference::FOLLOWS_FROM |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | $next($job); |
| 35 | 35 | |
| 36 | - $callableConfig = Config::get('jaravel.job.tags', fn () => [ |
|
| 36 | + $callableConfig = Config::get('jaravel.job.tags', fn() => [ |
|
| 37 | 37 | 'type' => 'job', |
| 38 | 38 | ]); |
| 39 | 39 | |
| 40 | - SpanTagHelper::setTags($span, Caller::call($callableConfig, [$job, $job->job ?? null])); |
|
| 40 | + SpanTagHelper::setTags($span, Caller::call($callableConfig, [ $job, $job->job ?? null ])); |
|
| 41 | 41 | |
| 42 | 42 | optional($tracer->getScopeManager()->getActive()) |
| 43 | 43 | ->close(); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * Describes configuration for incoming Http requests |
| 36 | 36 | */ |
| 37 | 37 | 'http' => [ |
| 38 | - 'span_name' => fn (Request $request) => 'App: ' . $request->path(), |
|
| 39 | - 'tags' => fn (Request $request, Response $response) => [ |
|
| 38 | + 'span_name' => fn(Request $request) => 'App: ' . $request->path(), |
|
| 39 | + 'tags' => fn(Request $request, Response $response) => [ |
|
| 40 | 40 | 'type' => 'http', |
| 41 | 41 | 'request_host' => $request->getHost(), |
| 42 | 42 | 'request_path' => $request->path(), |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * Describes configuration for console commands |
| 51 | 51 | */ |
| 52 | 52 | 'console' => [ |
| 53 | - 'span_name' => fn (string $command, ?InputInterface $input = null) => 'Console: ' . $command, |
|
| 54 | - 'filter_commands' => ['schedule:run', 'horizon', 'queue:'], |
|
| 55 | - 'tags' => fn (string $command, int $exitCode, ?InputInterface $input = null, ?OutputInterface $output = null) => [ |
|
| 53 | + 'span_name' => fn(string $command, ?InputInterface $input = null) => 'Console: ' . $command, |
|
| 54 | + 'filter_commands' => [ 'schedule:run', 'horizon', 'queue:' ], |
|
| 55 | + 'tags' => fn(string $command, int $exitCode, ?InputInterface $input = null, ?OutputInterface $output = null) => [ |
|
| 56 | 56 | 'type' => 'console', |
| 57 | 57 | 'console_command' => $command, |
| 58 | 58 | 'console_exit_code' => $exitCode, |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * Describes configuration for queued jobs |
| 64 | 64 | */ |
| 65 | 65 | 'job' => [ |
| 66 | - 'span_name' => fn ($realJob, ?Job $job) => 'Job: ' . get_class($realJob), |
|
| 67 | - 'tags' => fn ($realJob, ?Job $job) => [ |
|
| 66 | + 'span_name' => fn($realJob, ?Job $job) => 'Job: ' . get_class($realJob), |
|
| 67 | + 'tags' => fn($realJob, ?Job $job) => [ |
|
| 68 | 68 | 'type' => 'job', |
| 69 | 69 | 'job_class' => get_class($realJob), |
| 70 | 70 | 'job_id' => optional($job) |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $this->spanCreator |
| 24 | 24 | ->create( |
| 25 | - Caller::call(ConfigRepository::get('jaravel.console.span_name'), [$event->command, $event->input]) |
|
| 25 | + Caller::call(ConfigRepository::get('jaravel.console.span_name'), [ $event->command, $event->input ]) |
|
| 26 | 26 | ); |
| 27 | 27 | } |
| 28 | 28 | } |