I am curious about how distributed tracing can be provided to a message from a publisher and how this is received in the subscriber part just to get the possibility to get track about what could be happening when things go wrong in the point the message is sent (publisher) and the message is received (subscriber). This under python gcp pubsub client perspective.
I see this PR and it seems to pursue that, as it is also kind of explained in this article that the author of the PR owns. But it seems Open telemetry support for keeping traces of the flow of pub-sub messages is not still in place for gcp python client pub-sub
I wanted to mention this foreword just to ask the following question:
On the other hand, I see in the OTEL collector project the Google Cloud Pub Sub exporter and the Google Cloud Pub Sub Receiver modules, how is this different from the purpose of the above here mentioned PR?
I guess under the collector perspective those modules are for sending traces (already in OTEL collector) from an application perspective to a pub sub-topic (exporter) and for getting OTEL messages from a subscription (receiver), but not to trace the messages that a publisher send and a subscriber receive?
I would like to get a better comprehension about sending traces to a pub sub-topic or receiving OTEL messages from a subscription and the idea of generating tracing from a publisher to see the behavior of those messages until they reach the subscriber(s)
I guess under the collector perspective those modules are for sending traces (already in OTEL collector) from an application perspective to a pub sub-topic (exporter) and for getting OTEL messages from a subscription (receiver), but not to trace the messages that a publisher send and a subscriber receive?
Yes, this is the correct understanding.
I would like to get a better comprehension about sending traces to a pub sub-topic or receiving OTEL messages from a subscription and the idea of generating tracing from a publisher to see the behavior of those messages until they reach the subscriber(s)
This is not clear to me. Did you mean to ask how to trace messages sent/received to the pubsub topic, or did you want to know how to send traces to the topic?
Based on your earlier description, I assume you wanted to know about the former. This is slightly related to how one wants to get e22 visibility in other messaging/queuing systems such as Celery, Kafka etc. This is achieved by creating spans at the entry/exit points and propagating the context via message headers or something similar. Either the library natively supports OpenTelemetry (ex, what google pub-sub is trying to do) or the OpenTelemetry provides an instrumentation library to achieve the goal. The instrumentation usually wraps the original library API methods and produces a trace by intercepting the original calls. You can take a look at the current list of available instrumentation here https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation. That should also give you an idea of how to write one. I am not sure if this answers your question, but I hope it gives you some overall idea.