I've written a small Telemetry Processor to filter out some HTTP 404 which are not an issue for my application. I've been following Microsoft's doc on this process.
I have created a new class implementing ITelemetryProcessor and setup the constructor and process function.
namespace My_App
{
class WebJobQueuesDependencyFilter : ITelemetryProcessor
{
private ITelemetryProcessor Next { get; set; }
// Link processors to each other in a chain.
public WebJobQueuesDependencyFilter(ITelemetryProcessor next)
{
this.Next = next;
}
public void Process(ITelemetry item)
{
var request = item as RequestTelemetry;
if (request != null &&
request.ResponseCode.Equals("404", StringComparison.OrdinalIgnoreCase))
{
// To filter out an item, just terminate the chain:
return;
}
// Send everything else:
this.Next.Process(item);
}
}
}
I have also added a new line to my ApplicationInsights.config under <TelemetryProcessors>
<Add Type="My_App.WebJobQueuesDependencyFilter, My_App" />
Upon starting my program I see the following message recorded in AI in Visual Studio.
AI: ApplicationInsights configuration file loading failed. Type 'My_App.WebJobQueuesDependencyFilter, My_App' was not found. Type loading was skipped. Monitoring will continue.
I suspect the issue lies with the line in config. Microsoft's docs don't seem to detail exactly what that line should contain. My guess based on MS example is the namespaced path to the filter class and the namespace for my application.
My_App.WebJobQueuesDependencyFilter
) and then the assembly name so make sure your app isMy_App
. If this still doesn't work, how about initializing theTelemetryProcessor
directly instead of using the config, as shown here i.ebuilder.Use((next) => new WebJobQueuesDependencyFilter(next))
– degant