<p>I have a Kubernetes app that is constantly logging ServiceBusReceiver.Receive Dependency calls. It is creating 2000 logs per hour, per instance.
In the TelemtryClient there are only custom methods for TrackEvent and TrackException so these look like they are coming from somewhere else and I haven't been able to trace it to disable or find out why its logging so much. The TrackDependency method is part of the built in Microsoft.ApplicationInsights.TelemetryClient package. I have changed versions of packages to match another messaging app I have with no luck, and also updated packages to latest versions also with no luck. There isn't much other info in the logs to trace it.</p>
<p>SERVICEBUS ServiceBusReceiver.Receive</p>
<ul>
<li>Dependency Properties</li>
</ul>
<p>Type:   servicebus<br />
Call status:    true<br />
Duration:   1.0 mins<br />
Name:   ServiceBusReceiver.Receive<br />
Telemetry type: dependency<br />
Application version:    4.19.0.0<br />
SDK version dotnetc:2.21.0-429<br />
Sample rate:    1<br />
Performance:    1min-2min<br />
Base name:  ServiceBusReceiver.Receive</p>
<p>Other info about packages and versions installed:</p>
<ul>
<li><p>Sdk=&quot;Microsoft.NET.Sdk&quot;</p>
</li>
<li><p>net6.0</p>
</li>
<li><p>AzureFunctionsVersion v4</p>
</li>
<li><p>&quot;AutoMapper.Extensions.Microsoft.DependencyInjection&quot; Version=&quot;4.0.1&quot;</p>
</li>
<li><p>&quot;Azure.Messaging.ServiceBus&quot; Version=&quot;7.10.0&quot;</p>
</li>
<li><p>&quot;Microsoft.Azure.WebJobs.Extensions.ServiceBus&quot; Version=&quot;5.4.0&quot;</p>
</li>
<li><p>&quot;Microsoft.Azure.WebJobs.Logging.ApplicationInsights&quot; Version=&quot;3.0.33&quot;</p>
</li>
<li><p>&quot;Microsoft.NET.Sdk.Functions&quot; Version=&quot;4.0.1&quot;</p>
</li>
<li><p>&quot;Microsoft.Azure.Functions.Extensions&quot; Version=&quot;1.1.0&quot;</p>
</li>
<li><p>&quot;Microsoft.Extensions.Azure&quot; Version=&quot;1.2.0&quot;</p>
</li>
<li><p>&quot;Microsoft.Extensions.Configuration.AzureAppConfiguration&quot; Version=&quot;5.1.0&quot;</p>
</li>
<li><p>&quot;Microsoft.Extensions.Caching.Memory&quot; Version=&quot;6.0.1&quot;</p>
</li>
<li><p>&quot;Polly&quot; Version=&quot;7.1.0&quot;</p>
</li>
<li><p>&quot;Scrutor&quot; Version=&quot;4.1.0&quot;</p>
</li>
</ul>

<p>For that, you can write a <a href="https://learn.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling#itelemetryprocessor-and-itelemetryinitializer" rel="nofollow noreferrer">TelemetryProcessor</a>:</p>
<blockquote>
<p>Telemetry processors allow you to completely replace or discard a telemetry item.</p>
</blockquote>
<p>It could look like this:</p>
<pre class="lang-cs prettyprint-override"><code>public class ServiceBusTelemetryReducer : ITelemetryProcessor
{
    private readonly ITelemetryProcessor _next;
            
    public ServiceBusTelemetryReducer(ITelemetryProcessor next)
    {
        _next = next;
    }

    public void Process(ITelemetry item)
    {
        var isServiceBusReceiveTelemetry = item is DependencyTelemetry telemetry
            &amp;&amp; telemetry.Type == &quot;Azure Service Bus&quot;
            &amp;&amp; telemetry.Name == &quot;ServiceBusReceiver.Receive&quot;;

        // Only process telemetry that is relevant
        if (!isServiceBusReceiveTelemetry)
            _next.Process(item);
    }
}
</code></pre>
<p>Do not forget to register the processor:</p>
<pre class="lang-cs prettyprint-override"><code>services.AddApplicationInsightsTelemetryProcessor&lt;ServiceBusTelemetryReducer&gt;();
</code></pre>
