From 018e7fd2c3039fb43bc004b9a8efd033907330d8 Mon Sep 17 00:00:00 2001 From: Richard Chukwu Date: Fri, 11 Oct 2024 15:36:52 +0100 Subject: [PATCH 1/4] Update Symfony Messenger instrumentation to use SpanKind::KIND_PRODUCER and KIND_CONSUMER --- src/Instrumentation/Symfony/src/MessengerInstrumentation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php index 6fbdcc2c9..1a3f9b0f5 100644 --- a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php +++ b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php @@ -58,7 +58,7 @@ public static function register(): void $builder = $instrumentation ->tracer() ->spanBuilder(\sprintf('DISPATCH %s', $messageClass)) - ->setSpanKind(SpanKind::KIND_INTERNAL) + ->setSpanKind(SpanKind::KIND_PRODUCER) ->setAttribute(TraceAttributes::CODE_FUNCTION, $function) ->setAttribute(TraceAttributes::CODE_NAMESPACE, $class) ->setAttribute(TraceAttributes::CODE_FILEPATH, $filename) @@ -125,7 +125,7 @@ public static function register(): void $builder = $instrumentation ->tracer() ->spanBuilder(\sprintf('SEND %s', $messageClass)) - ->setSpanKind(SpanKind::KIND_INTERNAL) + ->setSpanKind(SpanKind::KIND_CONSUMER) ->setAttribute(TraceAttributes::CODE_FUNCTION, $function) ->setAttribute(TraceAttributes::CODE_NAMESPACE, $class) ->setAttribute(TraceAttributes::CODE_FILEPATH, $filename) From 66fa258767f8cef7f0a33e796e5487e507bbec06 Mon Sep 17 00:00:00 2001 From: Richard Chukwu Date: Fri, 11 Oct 2024 16:40:59 +0100 Subject: [PATCH 2/4] test file edit to match instrumentation --- .../tests/Integration/MessengerInstrumentationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php b/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php index 8f0cff152..bf3242bde 100644 --- a/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php +++ b/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php @@ -157,7 +157,7 @@ public function sendDataProvider(): array [ new SendEmailMessage('Hello Again'), 'SEND OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage', - SpanKind::KIND_INTERNAL, + SpanKind::KIND_CONSUMER, [ MessengerInstrumentation::ATTRIBUTE_MESSENGER_TRANSPORT => class_exists('Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport') ? 'Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport' : 'Symfony\Component\Messenger\Transport\InMemoryTransport', MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage', @@ -172,7 +172,7 @@ public function dispatchDataProvider(): array [ new SendEmailMessage('Hello Again'), 'DISPATCH OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage', - SpanKind::KIND_INTERNAL, + SpanKind::KIND_PRODUCER, [ MessengerInstrumentation::ATTRIBUTE_MESSENGER_BUS => 'Symfony\Component\Messenger\MessageBus', MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage', From bdbb36f6cb4c5df8130728ebd984399a867c0a4f Mon Sep 17 00:00:00 2001 From: Richard Chukwu <79311274+RichardChukwu@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:49:52 +0100 Subject: [PATCH 3/4] Send instrumentation updated to KIND_PRODUCER --- src/Instrumentation/Symfony/src/MessengerInstrumentation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php index 1a3f9b0f5..9b0b8e606 100644 --- a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php +++ b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php @@ -125,7 +125,7 @@ public static function register(): void $builder = $instrumentation ->tracer() ->spanBuilder(\sprintf('SEND %s', $messageClass)) - ->setSpanKind(SpanKind::KIND_CONSUMER) + ->setSpanKind(SpanKind::KIND_PRODUCER) ->setAttribute(TraceAttributes::CODE_FUNCTION, $function) ->setAttribute(TraceAttributes::CODE_NAMESPACE, $class) ->setAttribute(TraceAttributes::CODE_FILEPATH, $filename) From 730c424b9f4e90694ec46645c12abc93cfb9e5d1 Mon Sep 17 00:00:00 2001 From: Richard Chukwu Date: Wed, 16 Oct 2024 00:12:57 +0100 Subject: [PATCH 4/4] Test updated --- src/Instrumentation/Symfony/src/MessengerInstrumentation.php | 2 +- .../Symfony/tests/Integration/MessengerInstrumentationTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php index 1a3f9b0f5..9b0b8e606 100644 --- a/src/Instrumentation/Symfony/src/MessengerInstrumentation.php +++ b/src/Instrumentation/Symfony/src/MessengerInstrumentation.php @@ -125,7 +125,7 @@ public static function register(): void $builder = $instrumentation ->tracer() ->spanBuilder(\sprintf('SEND %s', $messageClass)) - ->setSpanKind(SpanKind::KIND_CONSUMER) + ->setSpanKind(SpanKind::KIND_PRODUCER) ->setAttribute(TraceAttributes::CODE_FUNCTION, $function) ->setAttribute(TraceAttributes::CODE_NAMESPACE, $class) ->setAttribute(TraceAttributes::CODE_FILEPATH, $filename) diff --git a/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php b/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php index bf3242bde..63d38849c 100644 --- a/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php +++ b/src/Instrumentation/Symfony/tests/Integration/MessengerInstrumentationTest.php @@ -157,7 +157,7 @@ public function sendDataProvider(): array [ new SendEmailMessage('Hello Again'), 'SEND OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage', - SpanKind::KIND_CONSUMER, + SpanKind::KIND_PRODUCER, [ MessengerInstrumentation::ATTRIBUTE_MESSENGER_TRANSPORT => class_exists('Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport') ? 'Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport' : 'Symfony\Component\Messenger\Transport\InMemoryTransport', MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage',