opentelemetry-php icon indicating copy to clipboard operation
opentelemetry-php copied to clipboard

[Symfony auto-instrumentation] Messenger instrumentation should use SpanKind::KIND_PRODUCER, SpanKind::KIND_CONSUMER

Open dkarlovi opened this issue 1 year ago • 18 comments

Steps to reproduce

Enable Symfony auto-instrumentation with default setup.

What is the expected behavior?

Spans when creating the message should be marked with SpanKind::KIND_PRODUCER.

Spans when handling the message should be marked with SpanKind::KIND_CONSUMER.

https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#span-kind

What is the actual behavior?

Everything is marked KIND_INTERNAL and it seems the consumer is currently not instrumented at all (I might be wrong here, please feel free to correct me).

Additionally, it seems to me the names of the spans are also not correct, as shown in the table in the spec linked above?

dkarlovi avatar May 20 '24 12:05 dkarlovi

@agoallikmaa @brettmc Can you please assign this to me

AA2512 avatar Aug 22 '24 06:08 AA2512

Hello @AA2512 please I'd like to know if this is still being worked please? @brettmc for possible assigning

Thank you

RichardChukwu avatar Oct 06 '24 09:10 RichardChukwu

Hello and welcome, @RichardChukwu Please feel free to submit to work on this and submit a PR.

brettmc avatar Oct 06 '24 23:10 brettmc

Got it, I'll do just that. Thank you @brettmc

RichardChukwu avatar Oct 07 '24 05:10 RichardChukwu

Hi @brettmc can i take this up

chiomalovet avatar Oct 08 '24 09:10 chiomalovet

@chiomalovet it was just assigned to @RichardChukwu, unless he changed his mind, he should get dibs for a while to give it a shot.

dkarlovi avatar Oct 08 '24 13:10 dkarlovi

On Tue, 8 Oct 2024 at 2:04 PM, Dalibor Karlović @.***> wrote:

@chiomalovet https://github.com/chiomalovet it was just assigned to @RichardChukwu https://github.com/RichardChukwu, unless he changed his mind, he should get dibs for a while to give it a shot.

— Reply to this email directly, view it on GitHub https://github.com/open-telemetry/opentelemetry-php/issues/1314#issuecomment-2399791329, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2JQPTMNSYLGUBWTUON24X3Z2PJ5TAVCNFSM6AAAAABH7T4FAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJZG44TCMZSHE . You are receiving this because you were mentioned.Message ID: @.***>

Alright no problem Let me look for another one to work on

chiomalovet avatar Oct 08 '24 13:10 chiomalovet

Let me look for another one to work on

Great, there's not a shortage of work on the project(s)! :smile:

dkarlovi avatar Oct 09 '24 08:10 dkarlovi

Hello @dkarlovi please can you specify the exact folder location for this. I can't seem to figure out here symfony auto-instrumentation is in the repo inorder to apply a fix

RichardChukwu avatar Oct 11 '24 12:10 RichardChukwu

@RichardChukwu I know what you mean, I have the same issue navigating these OTEL repos, it's very confusing if you're not here day to day, I was about to suggest the contrib repo gets merged into this repo since the packages are now released from the split repos anyway. WDYT @bobstrecansky @brettmc?

To answer your question, it's here I believe: https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/src/Instrumentation/Symfony

dkarlovi avatar Oct 11 '24 12:10 dkarlovi

Hello @brettmc kindly review PR (https://github.com/open-telemetry/opentelemetry-php-contrib/pull/304) as a fix I submitted to this issue. I'll appreciate feedback where necessary too. Thank you

RichardChukwu avatar Oct 11 '24 14:10 RichardChukwu

@bobstrecansky I believe this issue shouldn't be closed because

it seems the consumer is currently not instrumented at all it seems to me the names of the spans are also not correct

The linked PR changed spans to KIND_PRODUCER, but KIND_CONSUMER wasn't updated (since it doesn't even exist, as noted) and the names weren't updated to match the spec either.

dkarlovi avatar Oct 16 '24 12:10 dkarlovi

@RichardChukwu some additional changes noted above, if you're interested in working on them :)

brettmc avatar Oct 16 '24 22:10 brettmc

Before working on this, just want to ensure i get you correctly @dkarlovi

Do you mean updating the code to introduce new spans with KIND_CONSUMER for the parts of the code handling message reception or processing as it doesn't exist?

For instance, based on the spec from what I can see, I presume key changes will be:

  • Adding the "consume" operation with SpanKind::KIND_CONSUMER for receiving messages.

  • Updating span names to use publish, send, and consume as per the spec, ensuring naming consistency for operations.

  • Instrumenting the SenderInterface for both sending and receiving spans, with the appropriate SpanKind (producer for sending and consumer for receiving).

Your thoughts please....

RichardChukwu avatar Oct 17 '24 08:10 RichardChukwu

Do you mean updating the code to introduce new spans with KIND_CONSUMER for the parts of the code handling message reception or processing as it doesn't exist?

Yes, correct. The messages being created and sent is currently fully instrumented, but them being received and processed is not instrumented at all, from my understanding at least.

dkarlovi avatar Oct 17 '24 08:10 dkarlovi

Alright, got it. I'll work on that and send a PR for a fix soon @dkarlovi

RichardChukwu avatar Oct 17 '24 09:10 RichardChukwu

Kindly check this https://github.com/open-telemetry/opentelemetry-php-contrib/pull/307 @brettmc @dkarlovi

RichardChukwu avatar Oct 17 '24 10:10 RichardChukwu

@chiomalovet if you're still up for it, you could take a look at the current state of the PR and continue from there. /cc @brettmc

dkarlovi avatar Mar 20 '25 09:03 dkarlovi