Hi,
I've been having a closer look on how to implement tracing in message bus scenarios.
The docs say this:
> There are two message bus styles that should be handled, Message Queues and Publish/Subscribe (Topics).
>
> From a tracing perspective, the message bus style is not important, only that the span context associated
> with the producer is propagated to the zero or more consumers of the message.
> It is then the responsibility of the consumer(s) to create a span to encapsulate processing of the
> consumed message and establish a FollowsFrom reference to the propagated span context.
Now imagine a messaging system with multiple components between publisher and consumer, where each component itself has OpenTracing support, so that the complete message lifecycle is captured by the trace.
An example here could involve a router and a broker component. The broker here will receive the messages sent via the router from the producers (accepting/acknowledging the messages and storing them) and will then deliver the messages to consumers.
In that sense, the broker would be the last part of the whole "producer"/"sender" chain, all spans of the involved components having "child of" relationships.
Similarly, the broker would be the first part of the "consumer" (or "message delivery") chain, starting the first span and propagating its context, with the consumer application extracting the context and using a "child-of" relationship.
The connection between the overall "producer" and "consumer" spans would be done inside the broker - a "receiveAndStoreMessage" span inside the broker would be followed by a "deliverMessage" span (ie. the "deliverMessage" span would have a FollowsFrom reference).
That at least would be my interpretation of how it should look like. The docs above only talk about the *consumer* starting the span, with a "FollowsFrom" relationship, not about the consumer possibly using a "childOf" reference.
How would you see such a scenario where the messaging components between publisher and consumer also have OpenTracing support?
This would be relevant to messaging-related opentracing-contrib projects.
Maybe a solution would be to make it configurable in the consumer application code, whether the extracted span context should be considered as the "producer" span, or the "consumer" span.
WDYT?
Best regards
Carsten Lohmann
(INST/ECS4)
Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | GERMANY |
www.bosch-si.com
Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B
Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten Lücke; Geschäftsführung: Dr. Stefan Ferber, Michael Hahn