My application writes a lot of logs ib Dependencies which caused it to be super expensive (even more expensive than my server farms + database) and we have not used it for anything for months. How can I disable the dependencies but keep the rest (requests ,exceptions, custom events, etc.)?
In the documentation, adding application insights is not separated from adding dependencies.
https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-dependencies
At the same time,
in application insights resource >Usage and estimated costs
The only options avalable are
-Data Sampling
But The custom events (and requests) have a great value for the business and I don't want them not to be logged because of a cap, or being sampled.
Dependency Tracking in Azure Application Insights. A dependency is an external component that is called by your app. It's typically a service called using HTTP, or a database, or a file system.
Once you have this configured, deploy your app to Azure App Service and you should be able to configure the log viewer to work. First, scroll down and click on 'App Service logs' and you should see something like this: Next, on the right, toggle Application Logging (Filesystem) to enable it.
Now click on Log stream on the left to attach to your application's logs. Navigate to your site and you should see log messages corresponding to the requests you're making to the application. View your Azure App Service live log stream. And that's it.
You can select your existing application insights instance if you want to use that. 1.4 Click on Review + Create and wait till your app service is deployed. 2.1 Go to your web app and click on configuration on left blade. You should see below 3 application settings automatically populated:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With