diff --git a/composer.json b/composer.json index e2a10ad..e01da1b 100755 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require": { "php": ">=8.3", - "utopia-php/span": "1.1.*", + "utopia-php/span": "3.0.*", "utopia-php/telemetry": "*", "utopia-php/validators": "0.*", "utopia-php/domains": "^2.0" diff --git a/composer.lock b/composer.lock index ae9d409..dbc17e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7732004aa2671415906ca3cc6950da8e", + "content-hash": "326929c0d5fd258432f2441f06801968", "packages": [ { "name": "brick/math", @@ -2108,16 +2108,16 @@ }, { "name": "utopia-php/span", - "version": "1.1.5", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/utopia-php/span.git", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5" + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/span/zipball/028406940ca92bdc88099f0b1a123a3b2cbdd4e5", - "reference": "028406940ca92bdc88099f0b1a123a3b2cbdd4e5", + "url": "https://api.github.com/repos/utopia-php/span/zipball/97f0ab6e9125c000262f8b5b007423d11fd1a9b3", + "reference": "97f0ab6e9125c000262f8b5b007423d11fd1a9b3", "shasum": "" }, "require": { @@ -2146,9 +2146,9 @@ "description": "Simple span tracing library for PHP with coroutine support", "support": { "issues": "https://github.com/utopia-php/span/issues", - "source": "https://github.com/utopia-php/span/tree/1.1.5" + "source": "https://github.com/utopia-php/span/tree/3.0.1" }, - "time": "2026-02-13T18:00:11+00:00" + "time": "2026-05-13T11:53:06+00:00" }, { "name": "utopia-php/telemetry", diff --git a/src/DNS/Server.php b/src/DNS/Server.php index 5345baa..87a7d1a 100644 --- a/src/DNS/Server.php +++ b/src/DNS/Server.php @@ -170,6 +170,7 @@ protected function onPacket(string $buffer, string $ip, int $port, ?int $maxResp $question = null; $response = null; + $level = null; try { // 1. Parse Message. @@ -179,7 +180,7 @@ protected function onPacket(string $buffer, string $ip, int $port, ?int $maxResp } catch (PartialDecodingException $e) { $this->handleError($e); - $span->set('level', 'warn'); + $level = 'warn'; $response = Message::response( $e->getHeader(), Message::RCODE_FORMERR, @@ -208,7 +209,7 @@ protected function onPacket(string $buffer, string $ip, int $port, ?int $maxResp $question = $query->questions[0] ?? null; if ($question === null) { - $span->set('level', 'warn'); + $level = 'warn'; $response = Message::response( $query->header, Message::RCODE_FORMERR, @@ -281,7 +282,7 @@ protected function onPacket(string $buffer, string $ip, int $port, ?int $maxResp $span->set('dns.response.code', $response->header->responseCode); $span->set('dns.response.answer_count', $response->header->answerCount); } - $span->finish(); + $span->finish($level); } } diff --git a/tests/resources/server.php b/tests/resources/server.php index 0e15140..6a0cfe7 100644 --- a/tests/resources/server.php +++ b/tests/resources/server.php @@ -19,7 +19,7 @@ } Span::setStorage(new Storage\Coroutine()); -Span::addExporter(new Exporter\Stdout()); +Span::setExporters(new Exporter\Stdout()); $port = (int) (getenv('PORT') ?: 5300); $server = new Swoole('0.0.0.0', $port);