This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.63k
stars
4.85k
forks
source link
[BUG] ServiceBus: don't report Receive activity when SB processor is used #47985
I use processor client and enable tracing. I expect to have Process and settlement activities, but not receive one since I don't initiate the receive operation in the user code.
But I see both - receive and process ones. Also I see receive operations for poll which my app didn't initiate either
Expected behavior
When processor client is used, we should not report any of the receive activities initiated by processor.
Actual behavior
Reproduction Steps
using Azure.Messaging.ServiceBus;
using Azure.Identity;
using OpenTelemetry.Trace;
AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", true);
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenTelemetry()
.WithTracing(tp => tp
.SetSampler(new AlwaysOnSampler())
.AddSource("*")
.AddAspNetCoreInstrumentation()
.AddOtlpExporter());
var sbClient = new ServiceBusClient("lm-tests.servicebus.windows.net", new DefaultAzureCredential());
var sbSender = sbClient.CreateSender("testme");
var sbProcessor = sbClient.CreateProcessor("testme");
sbProcessor.ProcessMessageAsync += m =>
{
Console.WriteLine($"processing {m.Message} {m.Message.ApplicationProperties.GetValueOrDefault("traceparent", null)}");
return Task.CompletedTask;
};
sbProcessor.ProcessErrorAsync += e => Task.CompletedTask;
var app = builder.Build();
app.MapGet("/send", () =>
{
return sbSender.SendMessageAsync(new ServiceBusMessage("hi!"));
});
await sbProcessor.StartProcessingAsync();
app.Run();
Library name and version
Azure.Messaging.ServiceBus 7.18.3
Describe the bug
I use processor client and enable tracing. I expect to have Process and settlement activities, but not receive one since I don't initiate the receive operation in the user code.
But I see both - receive and process ones. Also I see receive operations for poll which my app didn't initiate either
Expected behavior
When processor client is used, we should not report any of the receive activities initiated by processor.
Actual behavior
Reproduction Steps
Environment
Original report: https://bsky.app/profile/martindotnet.bsky.social/post/3lgkyf7pr2227