I`m logging telemetry in Application Insights for a .NET Framework 4.7.2 web application running on Azure App Service.
A lot of telemetry comes from static file requests like .js and .css files and is not interesting to me. Since it incurs storage costs, it would be better not to log them at all.
One of the ideas towards a solution is to filter ITelemetry items in a class implementing the ITelemetryProcessor interface, based on the url of the request.
public void Process(ITelemetry item)
{
if (item is RequestTelemetry request && request.Url.AbsolutePath.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
{
return;
}
this.Next.Process(item);
}
I suspect there might be more reliable / more effective ways accomplish what I want. Anyone?