Disabling dependency logging for Application insights on Azure app service (Web app)
If you don't need it, just remove the DependencyTrackingTelemetryModule from your ApplicationInsights.config file.
Look for this entry:
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
.....
</Add>
And remove it or comment out:
<!--<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
.....
</Add>-->
Another way is to set the sampling to 100% for Dependencies only. See the documentation for more information about that. But I think it is always better not to have something loaded or running what you don't need.
I think you can achieve that by creating a telemetry processor and disable the telemetry data within the Process
method.
Example:
public void Process(ITelemetry item)
{
var request = item as DependencyTelemetry;
// Don't process dependency telemetry
if (request != null)
{
return;
}
this.Next.Process(item);
}
See also: Filtering and preprocessing telemetry in the Application Insights SDK