# Transactions that are created automatically by Elastic.Apm.Azure.ServiceBus instrumentation doesn't contain child spans

**URL:** <https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [September 22, 2021, 3:26pm UTC](https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896 "2021-09-22T15:26:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![waczi](https://avatars.discourse-cdn.com/v4/letter/w/e47c2d/32.png) [@waczi](https://discuss.elastic.co/u/waczi)\
**Post date:** [September 22, 2021, 3:26pm UTC](https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896/1 "2021-09-22T15:26:01Z")

</div>

Hi,

I'm implementing the APM instrumentation for the [ASP.NET](http://ASP.NET) CORE application. The application sends and receives messages to/from Service Bus. I found in the documentation ([Supported technologies | APM .NET Agent Reference [1.11] | Elastic](https://www.elastic.co/guide/en/apm/agent/dotnet/current/supported-technologies.html#supported-cloud-services)) that the Azure Service Bus is supported technology by Elastic APM for _3.0.0+ Microsoft.Azure.ServiceBus_ library. I pulled the _Elastic.Apm.Azure.ServiceBus_ NuGet into the project, and added _MicrosoftAzureServiceBusDiagnosticsSubscriber_ to the _Startup.cs_ configuration like shown below:

```auto
app.UseElasticApm(
    _configuration,
    new AspNetCoreDiagnosticSubscriber(),
    new HttpDiagnosticsSubscriber(),
    new MicrosoftAzureServiceBusDiagnosticsSubscriber(),
    new AzureCosmosDbDiagnosticsSubscriber());

```

The documentation says that _A new transaction is created for received and receive deferred messages_. Indeed, the transaction is created, but there are no child spans e.g. for HTTP or Database calls, that are performed while handling messages received from Service Bus. I've decided to remove _MicrosoftAzureServiceBusDiagnosticsSubscriber_ and check whether it works when I'll create the transaction explicitly in the code, and it looks like everything is reported correctly then. You can see the timeline of those two approaches in the images below.

**Transaction created automatically by MicrosoftAzureServiceBusDiagnosticsSubscriber**

 ![biblioteka](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b6ed7a4c7f87f49cf9e4ef20653a6bd071c8d9fa.png)

**Transaction created explicitly in the code that handles Service Bus message Agent.Tracer.CaptureTransaction(...)**

 ![explicitly](https://us1.discourse-cdn.com/elastic/original/3X/5/3/538ee2d0047dfbbc96c28bf6b88e3bc43bc3cc11.png)

Versions:

- Elastic.Apm.Azure.ServiceBus 1.11.1
- Microsoft.Azure.ServiceBus 5.1.3
- Elastic stack 7.14.1

Can someone take a look on that and answer why the child spans are not tracked while using nuget instrumentation? Is there something wrong with the configuration?

Regards.

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [September 27, 2021, 2:32pm UTC](https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896/2 "2021-09-27T14:32:01Z")

</div>

Thanks for reporting @waczi,

to me this sounds the same as this issue: [Missing Dependencies when Using Microsoft.Azure.ServiceBus · Issue #1486 · elastic/apm-agent-dotnet · GitHub](https://github.com/elastic/apm-agent-dotnet/issues/1486)

Can you confirm if it's the same? If so, I'd suggest let's handle this through the GitHub issue.

---

<div class="post-metadata">

**Author:** ![waczi](https://avatars.discourse-cdn.com/v4/letter/w/e47c2d/32.png) [@waczi](https://discuss.elastic.co/u/waczi)\
**Post date:** [September 27, 2021, 3:12pm UTC](https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896/3 "2021-09-27T15:12:01Z")

</div>

Hi,

yes, it seems to be the same issue. I will add my findings in the GitHub thread and track it there.

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 18, 2021, 11:12am UTC](https://discuss.elastic.co/t/transactions-that-are-created-automatically-by-elastic-apm-azure-servicebus-instrumentation-doesnt-contain-child-spans/284896/4 "2021-10-18T11:12:18Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
