Open wang007 opened 7 months ago
cc @aaron-ai
@wang007 Could you provide me with more details about the motivation? Usually, we don't need to record the message body in span.
As you can see from the first image above, I've mounted a sendmessage hook
@wang007 The situation you mentioned occurs because the advice for sendMessageHook does not execute the context.makeCurrent() method to replace the current thread's context after starting a span. This may imply that the designers do not intend for others to retrieve context information via the OTel SDK at the time point of sending messages, nor to modify the span.
In fact, for the 4.x version of the rocketmq-client, the org.apache.rocketmq.client.producer.DefaultMQProducer#getDefaultMQProducerImpl()
method has been deprecated. Perhaps we should not obtain this object and register hook components at runtime.
If you're keen on capturing the body information of a message, there might be two approaches:
io.opentelemetry.instrumentation.rocketmqclient.v4_8.TracingSendMessageHookImpl#sendMessageBefore()
and inject it into an attribute. Incidentally, is there any plan from OTel to consistently log this attribute across all messaging-type instrumentations as features? @trask If so, I might be interested in contributing.I hope my answer can be of help to you.
I'm using the second solution, but I need to create an extra span. The issue is raised because other third-party components can get the current span content.
If you think that's how it's designed, close the issue.
thx @Cirilla-zmh
The issue is raised because other third-party components can get the current span content. If you think that's how it's designed, close the issue.
I believe the body of the message carries significant information, and it might be worth considering logging this information. We could implement it as a configurable feature.
I would be happy to contribute to this. But before doing so, I would like to know if contributions of this kind are welcome. @trask @aaron-ai @steverao
I believe the body of the message carries significant information, and it might be worth considering logging this information. We could implement it as a configurable feature.
I would be happy to contribute to this. But before doing so, I would like to know if contributions of this kind are welcome. @trask @aaron-ai @steverao
yes, I believe capturing message bodies would be accepted as an opt-in feature, similar to capturing request/response bodies in https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/8778
Describe the bug
I want to add message body to Producer Span but Couldn't get Producer span in rocketmq SendMessageHook.
This seems to be the result of not calling Context.attch()
my code
Steps to reproduce
ignore
Expected behavior
ignore
Actual behavior
ignore
Javaagent or library instrumentation version
1.32.0
Environment
JDK: 1.8 OS: mac
Additional context
No response