-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[META 605] Add span links for message tracing #2489
Comments
Consider adding instrumentation for Spring Kafka batch listener (#2601) and use it as a test case for span links |
So far, of all supported messaging system clients, only the Kafka plugin had to deal with batch processing. In this plugin, we wrap the batch iteration, allowing us to create a transaction-per-record. Therefore, as far as I can see, the scope of this spec implementation for the Java agent is as follows:
|
Correction: we also have this one to support similarly to Kafka: |
I'm not sure how strict this rule is, but the OTel spec on span links says that |
Thanks for pointing out!
So I think we are OK with this guidance. |
@trentm the said above is true for transactions. However, adding span links to message-polling spans cannot typically follow this guidance, as by nature, polling APIs return the received message only at exit time. Assuming that we want polling span to measure the polling duration, it means that we create and start the span on polling method entry and end it on exit, which is only when we can look for the sender's tracecontext. |
@eyalkoren https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md#batch-receiving shows an example from OTel where there are separate spans for "message receive" and "message processing". In their example they add a span link on the "message processing" span. I don't know if that is relevant or useful for the case you describe. (I vaguely recall some discussion about how to model spans for messaging systems back when Russ was adding Azure support, but I wasn't following very closely at the time.)
I suspect that it is probably fine to add span links late (after span creation) for our agents, if necessary. open-telemetry/opentelemetry-specification#454 is an OTel Spec discussion on potentially (re-)allowing this. |
This OTel example is about a poll action that takes place when there is no active context. The guidance is then to create an orphan span for the receive action and a child span per message with a single span link. I don't mind doing that once our UI properly renders distributed traces based on links. But as it is now, if I change our tracing to do that, it will be an unfortunate breaking change for our existing users, as it will break their currently properly-presented full traces, because there will be no parent-child relationships to represent the distributed trace. What I referred to is a polling span, i.e.- a polling action traced when there is an active context (transaction/span). As opposed to the former scenario, in this one there is no incentive to do all kind of sophisticated and risky assumptions to trace message handling as it will be automatically traced as child actions of the active transaction/span. So in this scenario, I would say a polling span is enough to represent the involvement of a messaging system and with the ability to link to the sending span, that's even better covered. |
Meta issue:
Spec issue:
Summary of spec changes:
The text was updated successfully, but these errors were encountered: