Skip to content

[OTel] Activity is not produced for BasicConsumeAsync on .NET Framework #1533

@Kielek

Description

@Kielek

Describe the bug

Following code does not generate activity for RabbitMQ.Client.Subscriber activity source.

var consumer = new EventingBasicConsumer(channel);
consumer.Received += (model, ea) =>
{
    var receivedBody = ea.Body.ToArray();
    var receivedMessage = Encoding.UTF8.GetString(receivedBody);
    Console.WriteLine($"Received: {receivedMessage}");
};
channel.BasicConsumeAsync(queue: "hello", autoAck: true, consumer);

Reproduction steps

  1. Have an application consuming messages from queue: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/pull/3373/files#diff-b8bf5e4638613373d455983b52f680cbac4c13732b860567bda571a9e0b29638R40-R44
  2. Have properly defined listener for RabbitMQ.Client.Subscriber
  3. If you are using channel.BasicConsumeAsync on .NET Framework 4.6.2, Activity is not generated for channel.BasicConsumeAsync.

It is working fine for .NET6, .NET7 and .NET8. channel.BasicGetAsync generated proper activities.

Expected behavior

Activity RabbitMQ.Client.Subscriber is generated also for channel.BasicConsumeAsync method on .NET Framework.

Additional context

Found while working on introducing RabbitMQ.Client in OpenTelemetry .NET Automatic Instrumentation.

PR: open-telemetry/opentelemetry-dotnet-instrumentation#3373

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions