Skip to content

Commit

Permalink
Move $scheme before install_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
PROFeNoM committed Mar 27, 2024
1 parent c3c7673 commit 312faa1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Integrations/Integrations/Swoole/SwooleIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ public function requiresExplicitTraceAnalyticsEnabling()

public function instrumentRequestStart(callable $callback, SwooleIntegration $integration, Server $server)
{
$scheme = $server->ssl ? 'https://' : 'http://';

\DDTrace\install_hook(
$callback,
function (HookData $hook) use ($integration, $server) {
function (HookData $hook) use ($integration, $server, $scheme) {
$rootSpan = $hook->span(new SpanStack());
$rootSpan->name = "web.request";
$rootSpan->service = \ddtrace_config_app_name('swoole');
Expand Down Expand Up @@ -97,7 +99,6 @@ function (HookData $hook) use ($integration, $server) {
$rootSpan->resource = $request->server['request_method'] . ' ' . $normalizedPath;
$rootSpan->meta[Tag::HTTP_METHOD] = $request->server['request_method'];

$scheme = $server->ssl ? 'https://' : 'http://';
$host = $headers['host'] ?? ($request->server['remote_addr'] . ':' . $request->server['server_port']);
$path = $request->server['request_uri'] ?? $request->server['path_info'] ?? '';
$query = isset($request->server['query_string']) ? '?' . $request->server['query_string'] : '';
Expand Down

0 comments on commit 312faa1

Please sign in to comment.