fsprojects / pulsar-client-dotnet

Apache Pulsar native client for .NET (C#/F#/VB)
MIT License
301 stars 47 forks source link

How to continue the "Trace" from the "Producer" after obtaining the messages by "Consumer. ReceiveAsync" #277

Closed brotherhorse closed 3 weeks ago

brotherhorse commented 1 month ago

like this:

Messages<byte[]> msgs = await consumer.BatchReceiveAsync(cancellationToken).ConfigureAwait(false);

using (var activity=Activity.Current?.Source.StartActivity("MyBusiness")) { activity?.SetTag("business", "mybusiness"); _log.LogInformation("Hello world");
}

brotherhorse commented 1 month ago

like this:

Messages<byte[]> msg = await consumer.ReceiveAsync(cancellationToken).ConfigureAwait(false);

using (var activity=Activity.Current?.Source.StartActivity("MyBusiness")) { activity?.SetTag("business", "mybusiness"); _log.LogInformation("Hello world"); }

Lanayx commented 1 month ago

Hi! You can check out the example and the source code of the interceptor.

brotherhorse commented 3 weeks ago

I Got it, var parentContext = Propagators.DefaultTextMapPropagator.Extract(default, p.Properties, Getter);