apache/pulsar-dotpulsar

DotPulsar OpenTelemetry

Ceyword opened this issue · 4 comments

Hello,
A few Dotpulsar-OpenTelemetry Questions:
1- Does Dotpulsar propagate trace context from producer to Pulsar broker?
2- Does Pulsar broker propagate trace context to Dotpulsar consumer?
3- If Pulsar broker propagate trace context to consumer, how do we retrieve it in Dotpulsar?
4- I followed the guidance here(https://github.com/apache/pulsar-dotpulsar/wiki/Tracing) to enable OpenTelemetry tracing.
Metrics worked but tracing did not. Do we need to do something special to activate 'DotPulsar' source? Below is the code:

services.AddOpenTelemetry()
.ConfigureResource(builder => builder.AddService(serviceName: "DotPulsarClient"))
.WithTracing(builder => builder.AddSource("DotPulsar"))
.WithMetrics(builder => builder.AddMeter("DotPulsar"));

Thank you

Hi @Ceyword
When building the producer, you have to call "AttachTraceInfoToMessages" on the builder to have the Producer send trace info with the messages (it is added to the MessageMetadata).
On the consumer side, you need to receive the messages using the 'Process' extension method and make sure the ProcessingOptions have "LinkTraces" set to true.
Let me know if this helps :-)

Hello @blankensteiner ,
Yes, applying these steps activated tracing beautifully, thank you. However, the auto-acknowledgment behavior of the 'Process' extension method raises two questions.
1- Does this mean that we cannot send negative-acknowledgments when using 'Process' method?
2- If so, what is the workaround to manage failed message processing etc.?
Thank you

Hi @Ceyword
DotPulsar doesn't support negative-acknowledgements (which is just the client waiting x number of seconds and then giving the message to the end-user again).
I would suggest retrying (wrap your process method in a while with try/catch) until you are able to process the method or move it to a retry queue.
Does this answer your questions? :-)

Thank you @blankensteiner , I will implement the retry accordingly.

negative-acknowledgements ( which is just the client waiting x number of seconds and then giving the message to the end-user again)

Good critique of Nack.