From a2db5769d95409ec61113331db93890536a6085b Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 18:56:58 +0100 Subject: [PATCH 1/9] Fixing Logs/Monolog. --- src/Logs/Monolog/composer.json | 2 +- src/Logs/Monolog/tests/Integration/HandlerTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Logs/Monolog/composer.json b/src/Logs/Monolog/composer.json index b91f82ef..a08b4992 100644 --- a/src/Logs/Monolog/composer.json +++ b/src/Logs/Monolog/composer.json @@ -10,7 +10,7 @@ "prefer-stable": true, "require": { "monolog/monolog": "^1.1|^2|^3", - "open-telemetry/api": "^1.0.0beta10" + "open-telemetry/api": "^1.0.0beta16" }, "autoload": { "psr-4": { diff --git a/src/Logs/Monolog/tests/Integration/HandlerTest.php b/src/Logs/Monolog/tests/Integration/HandlerTest.php index b2360b53..671e46be 100644 --- a/src/Logs/Monolog/tests/Integration/HandlerTest.php +++ b/src/Logs/Monolog/tests/Integration/HandlerTest.php @@ -12,7 +12,7 @@ use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeFactory; use OpenTelemetry\SDK\Logs\Exporter\InMemoryExporter; use OpenTelemetry\SDK\Logs\LoggerProvider; -use OpenTelemetry\SDK\Logs\Processor\SimpleLogsProcessor; +use OpenTelemetry\SDK\Logs\Processor\SimpleLogRecordProcessor; use OpenTelemetry\SDK\Logs\ReadWriteLogRecord; use PHPUnit\Framework\TestCase; @@ -29,7 +29,7 @@ public function setUp(): void $this->storage = new ArrayObject(); $exporter = new InMemoryExporter($this->storage); $loggerProvider = new LoggerProvider( - new SimpleLogsProcessor($exporter), + new SimpleLogRecordProcessor($exporter), new InstrumentationScopeFactory(Attributes::factory()), ); $handler = new Handler($loggerProvider, 200); From 888645b36ffa53cebc5b24ad45abb025a0bd9a72 Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 18:57:15 +0100 Subject: [PATCH 2/9] Fixing Aws\Xray. --- src/Aws/tests/Unit/Xray/PropagatorTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Aws/tests/Unit/Xray/PropagatorTest.php b/src/Aws/tests/Unit/Xray/PropagatorTest.php index e5449072..5ec0a415 100644 --- a/src/Aws/tests/Unit/Xray/PropagatorTest.php +++ b/src/Aws/tests/Unit/Xray/PropagatorTest.php @@ -7,6 +7,7 @@ use OpenTelemetry\API\Trace\SpanContext; use OpenTelemetry\API\Trace\SpanContextInterface; use OpenTelemetry\API\Trace\SpanContextValidator; +use OpenTelemetry\API\Trace\TraceFlags; use OpenTelemetry\API\Trace\TraceState; use OpenTelemetry\Aws\Xray\Propagator; use OpenTelemetry\Context\Context; @@ -45,7 +46,7 @@ public function InjectValidSampledTraceId() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED), + SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED), Context::getCurrent() ) ); @@ -67,7 +68,7 @@ public function InjectValidNotSampledTraceId() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_DEFAULT), + SpanContext::create(self::TRACE_ID, self::SPAN_ID), Context::getCurrent() ) ); @@ -89,7 +90,7 @@ public function InjectTraceIdWithTraceState() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')), + SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')), Context::getCurrent() ) ); @@ -111,7 +112,7 @@ public function InjectTraceIdWithInvalidSpanContext() $carrier, null, $this->withSpanContext( - SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')), + SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')), Context::getCurrent() ) ); From 174758ca4487bcc8db2a74c4be4902d2920f2ca9 Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 18:57:42 +0100 Subject: [PATCH 3/9] Fixing PropagatorTest. --- .../TraceResponse/tests/Unit/PropagatorTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Propagation/TraceResponse/tests/Unit/PropagatorTest.php b/src/Propagation/TraceResponse/tests/Unit/PropagatorTest.php index 6ec2337d..6c64eac0 100644 --- a/src/Propagation/TraceResponse/tests/Unit/PropagatorTest.php +++ b/src/Propagation/TraceResponse/tests/Unit/PropagatorTest.php @@ -7,6 +7,7 @@ use OpenTelemetry\API\Trace\SpanContext; use OpenTelemetry\API\Trace\SpanContextInterface; use OpenTelemetry\API\Trace\SpanContextValidator; +use OpenTelemetry\API\Trace\TraceFlags; use OpenTelemetry\API\Trace\TraceState; use OpenTelemetry\Context\Context; use OpenTelemetry\Context\ContextInterface; @@ -43,7 +44,7 @@ public function test_inject_valid_sampled_trace_id() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED), + SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED), Context::getCurrent() ) ); @@ -65,7 +66,7 @@ public function test_inject_valid_not_sampled_trace_id() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_DEFAULT), + SpanContext::create(self::TRACE_ID, self::SPAN_ID), Context::getCurrent() ) ); @@ -87,7 +88,7 @@ public function test_inject_trace_id_with_trace_state() $carrier, null, $this->withSpanContext( - SpanContext::create(self::TRACE_ID, self::SPAN_ID, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')), + SpanContext::create(self::TRACE_ID, self::SPAN_ID, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')), Context::getCurrent() ) ); @@ -109,7 +110,7 @@ public function test_inject_trace_id_with_invalid_span_context() $carrier, null, $this->withSpanContext( - SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, SpanContextInterface::TRACE_FLAG_SAMPLED, new TraceState('vendor1=opaqueValue1')), + SpanContext::create(SpanContextValidator::INVALID_TRACE, SpanContextValidator::INVALID_SPAN, TraceFlags::SAMPLED, new TraceState('vendor1=opaqueValue1')), Context::getCurrent() ) ); From 92ad67646959b51855ede40fa0baf645c079d06a Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 19:17:11 +0100 Subject: [PATCH 4/9] Fixing MongoDBInstrumentation import of CachedInstrumentation. --- src/Instrumentation/MongoDB/composer.json | 2 +- src/Instrumentation/MongoDB/src/MongoDBInstrumentation.php | 2 +- .../MongoDB/src/MongoDBInstrumentationSubscriber.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Instrumentation/MongoDB/composer.json b/src/Instrumentation/MongoDB/composer.json index b02acda9..52e7e3d6 100644 --- a/src/Instrumentation/MongoDB/composer.json +++ b/src/Instrumentation/MongoDB/composer.json @@ -12,7 +12,7 @@ "ext-mongodb": "*", "ext-json": "*", "mongodb/mongodb": "^1.15", - "open-telemetry/api": "^1.0.0beta10", + "open-telemetry/api": "^1.0.0beta12", "open-telemetry/sem-conv": "^1" }, "require-dev": { diff --git a/src/Instrumentation/MongoDB/src/MongoDBInstrumentation.php b/src/Instrumentation/MongoDB/src/MongoDBInstrumentation.php index 8f8dd3ca..555cf5ca 100644 --- a/src/Instrumentation/MongoDB/src/MongoDBInstrumentation.php +++ b/src/Instrumentation/MongoDB/src/MongoDBInstrumentation.php @@ -5,7 +5,7 @@ namespace OpenTelemetry\Contrib\Instrumentation\MongoDB; use function MongoDB\Driver\Monitoring\addSubscriber; -use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation; +use OpenTelemetry\API\Instrumentation\CachedInstrumentation; final class MongoDBInstrumentation { diff --git a/src/Instrumentation/MongoDB/src/MongoDBInstrumentationSubscriber.php b/src/Instrumentation/MongoDB/src/MongoDBInstrumentationSubscriber.php index 94f95a3d..5dd5d7fe 100644 --- a/src/Instrumentation/MongoDB/src/MongoDBInstrumentationSubscriber.php +++ b/src/Instrumentation/MongoDB/src/MongoDBInstrumentationSubscriber.php @@ -9,7 +9,7 @@ use MongoDB\Driver\Monitoring\CommandStartedEvent; use MongoDB\Driver\Monitoring\CommandSubscriber; use MongoDB\Driver\Monitoring\CommandSucceededEvent; -use OpenTelemetry\API\Common\Instrumentation\CachedInstrumentation; +use OpenTelemetry\API\Instrumentation\CachedInstrumentation; use OpenTelemetry\API\Trace\Span; use OpenTelemetry\API\Trace\SpanBuilderInterface; use OpenTelemetry\API\Trace\SpanKind; From e7b28030bf5a8ae780a598d882f9598f0c82d67f Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 15:05:49 +0100 Subject: [PATCH 5/9] Fixing Instrumentation/Laravel linting. --- src/Instrumentation/Laravel/src/HeadersPropagator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Instrumentation/Laravel/src/HeadersPropagator.php b/src/Instrumentation/Laravel/src/HeadersPropagator.php index f7aa407d..423990e6 100644 --- a/src/Instrumentation/Laravel/src/HeadersPropagator.php +++ b/src/Instrumentation/Laravel/src/HeadersPropagator.php @@ -24,6 +24,7 @@ public static function instance(): self public function keys($carrier): array { assert($carrier instanceof Request); + /** @psalm-suppress InvalidReturnStatement */ return $carrier->headers->keys(); } From 20597ab74012126e6f838fbef42f1b33c1a4d828 Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 19:33:47 +0100 Subject: [PATCH 6/9] Fixing Instrumentation/Symfony linting. --- src/Instrumentation/Symfony/src/RequestPropagationGetter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Instrumentation/Symfony/src/RequestPropagationGetter.php b/src/Instrumentation/Symfony/src/RequestPropagationGetter.php index 2b4e48ad..7bdcf271 100644 --- a/src/Instrumentation/Symfony/src/RequestPropagationGetter.php +++ b/src/Instrumentation/Symfony/src/RequestPropagationGetter.php @@ -24,6 +24,7 @@ public static function instance(): self public function keys($carrier): array { assert($carrier instanceof Request); + /** @psalm-suppress InvalidReturnStatement */ return $carrier->headers->keys(); } From 734f436edf4cafc6d47df45e51779516057c28b3 Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 19:39:17 +0100 Subject: [PATCH 7/9] Fixing Instrumentation/HttpAsyncClient linting. --- .../tests/Integration/HttpAsyncClientInstrumentationTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Instrumentation/HttpAsyncClient/tests/Integration/HttpAsyncClientInstrumentationTest.php b/src/Instrumentation/HttpAsyncClient/tests/Integration/HttpAsyncClientInstrumentationTest.php index 712c41a1..125f46c4 100644 --- a/src/Instrumentation/HttpAsyncClient/tests/Integration/HttpAsyncClientInstrumentationTest.php +++ b/src/Instrumentation/HttpAsyncClient/tests/Integration/HttpAsyncClientInstrumentationTest.php @@ -64,6 +64,7 @@ public function test_send_async_requests(): void $this->client->sendAsyncRequest($request); $this->client->sendAsyncRequest($request); $this->assertCount(0, $this->storage, 'no spans exporter since promises are not resolved yet'); + //resolve promises try { $p2->wait(); From 01614a978093641e820105ccadf5be6e05eba34c Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 19:43:02 +0100 Subject: [PATCH 8/9] Fixing Instrumentation/Symfony linting. --- src/Instrumentation/Symfony/src/ResponsePropagationSetter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Instrumentation/Symfony/src/ResponsePropagationSetter.php b/src/Instrumentation/Symfony/src/ResponsePropagationSetter.php index f233c1b1..1602b976 100644 --- a/src/Instrumentation/Symfony/src/ResponsePropagationSetter.php +++ b/src/Instrumentation/Symfony/src/ResponsePropagationSetter.php @@ -24,6 +24,7 @@ public static function instance(): self public function keys($carrier): array { assert($carrier instanceof Response); + /** @psalm-suppress InvalidReturnStatement */ return $carrier->headers->keys(); } From 52060c3ed3b6e3bca21a6731f861ea6ee0dcf62b Mon Sep 17 00:00:00 2001 From: Chris Lightfoot-Wild Date: Mon, 28 Aug 2023 19:48:29 +0100 Subject: [PATCH 9/9] Fixing Symfony import. --- src/Symfony/src/OtelBundle/Console/ConsoleListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/src/OtelBundle/Console/ConsoleListener.php b/src/Symfony/src/OtelBundle/Console/ConsoleListener.php index 010e4ab2..04caf611 100644 --- a/src/Symfony/src/OtelBundle/Console/ConsoleListener.php +++ b/src/Symfony/src/OtelBundle/Console/ConsoleListener.php @@ -5,7 +5,7 @@ namespace OpenTelemetry\Contrib\Symfony\OtelBundle\Console; use function get_class; -use OpenTelemetry\API\Trace\AbstractSpan as Span; +use OpenTelemetry\API\Trace\Span; use OpenTelemetry\API\Trace\StatusCode; use OpenTelemetry\API\Trace\TracerInterface; use OpenTelemetry\API\Trace\TracerProviderInterface;