@@ -146,8 +146,13 @@ public function dispatch(object $message, array $stamps = []): Envelope
146146 'name ' => $ this ->stringContains ('create ' ),
147147 'kind ' => SpanKind::KIND_PRODUCER ,
148148 'attributes ' => [
149- MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
149+ // Required attributes
150+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
150151 TraceAttributes::MESSAGING_OPERATION_TYPE => 'create ' ,
152+ TraceAttributes::MESSAGING_DESTINATION_NAME => $ this ->isType ('string ' ),
153+
154+ // Symfony-specific attributes
155+ MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
151156 ],
152157 ],
153158 ]
@@ -193,8 +198,13 @@ public function send(Envelope $envelope): Envelope
193198 'name ' => $ this ->stringContains ('send ' ),
194199 'kind ' => SpanKind::KIND_PRODUCER ,
195200 'attributes ' => [
196- MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
201+ // Required attributes
202+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
197203 TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
204+ TraceAttributes::MESSAGING_DESTINATION_NAME => $ this ->isType ('string ' ),
205+
206+ // Symfony-specific attributes
207+ MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
198208 ],
199209 ],
200210 ]
@@ -233,10 +243,28 @@ public function test_handle_message()
233243 [
234244 'name ' => 'send ' . (class_exists ('Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport ' ) ? 'Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport ' : 'Symfony\Component\Messenger\Transport\InMemoryTransport ' ),
235245 'kind ' => SpanKind::KIND_PRODUCER ,
246+ 'attributes ' => [
247+ // Required attributes
248+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
249+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
250+ TraceAttributes::MESSAGING_DESTINATION_NAME => $ this ->isType ('string ' ),
251+
252+ // Symfony-specific attributes
253+ MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
254+ ],
236255 ],
237256 [
238257 'name ' => 'receive transport ' ,
239258 'kind ' => SpanKind::KIND_CONSUMER ,
259+ 'attributes ' => [
260+ // Required attributes
261+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
262+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'receive ' ,
263+ TraceAttributes::MESSAGING_DESTINATION_NAME => 'transport ' ,
264+
265+ // Symfony-specific attributes
266+ MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
267+ ],
240268 ],
241269 ]
242270 );
@@ -283,6 +311,13 @@ public function handle(Envelope $envelope, \Symfony\Component\Messenger\Middlewa
283311 ),
284312 'kind ' => SpanKind::KIND_INTERNAL ,
285313 'attributes ' => [
314+ // Required attributes
315+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
316+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'middleware ' ,
317+ TraceAttributes::MESSAGING_DESTINATION_NAME => $ this ->isType ('string ' ),
318+
319+ // Symfony-specific attributes
320+ MessengerInstrumentation::ATTRIBUTE_MESSAGING_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
286321 MessengerInstrumentation::ATTRIBUTE_MESSAGING_MIDDLEWARE => $ this ->logicalNot ($ this ->isEmpty ()),
287322 ],
288323 ],
@@ -312,10 +347,16 @@ public function test_stamp_information()
312347 'name ' => 'send ' . (class_exists ('Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport ' ) ? 'Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport ' : 'Symfony\Component\Messenger\Transport\InMemoryTransport ' ),
313348 'kind ' => SpanKind::KIND_PRODUCER ,
314349 'attributes ' => [
350+ // Required attributes
351+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
352+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
353+ TraceAttributes::MESSAGING_DESTINATION_NAME => $ this ->isType ('string ' ),
354+ TraceAttributes::MESSAGING_MESSAGE_ID => 'test-id ' ,
355+
356+ // Symfony-specific attributes
357+ MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
315358 'messaging.symfony.bus ' => 'test_bus ' ,
316359 'messaging.symfony.delay ' => 1000 ,
317- TraceAttributes::MESSAGING_MESSAGE_ID => 'test-id ' ,
318- TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
319360 ],
320361 ],
321362 ]
@@ -361,9 +402,19 @@ public function sendDataProvider(): array
361402 'send ' . $ transportClass ,
362403 SpanKind::KIND_PRODUCER ,
363404 [
405+ // Required attributes
406+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
407+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
364408 TraceAttributes::MESSAGING_DESTINATION_NAME => $ transportClass ,
409+
410+ // Symfony-specific attributes
365411 MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
366- TraceAttributes::MESSAGING_OPERATION_TYPE => 'send ' ,
412+
413+ // Code attributes
414+ TraceAttributes::CODE_FUNCTION_NAME => 'send ' ,
415+ TraceAttributes::CODE_NAMESPACE => $ this ->stringContains ('Symfony\Component\Messenger\Transport ' ),
416+ TraceAttributes::CODE_FILEPATH => $ this ->isType ('string ' ),
417+ TraceAttributes::CODE_LINE_NUMBER => $ this ->greaterThan (0 ),
367418 ],
368419 ],
369420 ];
@@ -377,10 +428,20 @@ public function dispatchDataProvider(): array
377428 'create Symfony\Component\Messenger\MessageBus ' ,
378429 SpanKind::KIND_PRODUCER ,
379430 [
431+ // Required attributes
432+ TraceAttributes::MESSAGING_SYSTEM => 'symfony ' ,
433+ TraceAttributes::MESSAGING_OPERATION_TYPE => 'create ' ,
434+ TraceAttributes::MESSAGING_DESTINATION_NAME => 'Symfony\Component\Messenger\MessageBus ' ,
435+
436+ // Symfony-specific attributes
380437 MessengerInstrumentation::ATTRIBUTE_MESSENGER_BUS => 'Symfony\Component\Messenger\MessageBus ' ,
381438 MessengerInstrumentation::ATTRIBUTE_MESSENGER_MESSAGE => 'OpenTelemetry\Tests\Instrumentation\Symfony\tests\Integration\SendEmailMessage ' ,
382- TraceAttributes::MESSAGING_DESTINATION_NAME => 'Symfony\Component\Messenger\MessageBus ' ,
383- TraceAttributes::MESSAGING_OPERATION_TYPE => 'create ' ,
439+
440+ // Code attributes
441+ TraceAttributes::CODE_FUNCTION_NAME => 'dispatch ' ,
442+ TraceAttributes::CODE_NAMESPACE => $ this ->stringContains ('Symfony\Component\Messenger ' ),
443+ TraceAttributes::CODE_FILEPATH => $ this ->isType ('string ' ),
444+ TraceAttributes::CODE_LINE_NUMBER => $ this ->greaterThan (0 ),
384445 ],
385446 ],
386447 ];
0 commit comments