Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell Application Insights to ignore 404 responses

ApplicationInsights has recently started mailing me a Weekly Telemetry Report. My problem is that it tells me that I have a bunch of Failed Requests, Failed Dependencies, and Exceptions, but when I click through to analyze the failures I see that they are all associated with attempts by bots or Bad Guys to access nonexistent pages in my website.

Is there an easy way to tell ApplicationInsights that I am not interested in metrics associated with attempts to access nonexistent pages? Yes, I appreciate the Weekly Telemetry Report, but I don't want to have to take the time to investigate a category of frequently reported problems that I consider "false positives".

like image 679
Bob.at.Indigo.Health Avatar asked May 30 '16 20:05

Bob.at.Indigo.Health


People also ask

How do I see exceptions in application insights?

Open the Application Insights Search telemetry window in Visual Studio. While debugging, select the Application Insights dropdown box. Select an exception report to show its stack trace. To open the relevant code file, select a line reference in the stack trace.

How do I turn off sampling in application insights?

To switch off adaptive sampling, remove the AdaptiveSamplingTelemetryProcessor node(s) from ApplicationInsights.


1 Answers

You can modify the request telemetry and mark it as a Success (not Fail). This way, the request will be properly logged by the AI but as a successful one. You need to implement a Telemetry Initializer.

Example:

public class CustomTelemetryInitializer : ITelemetryInitializer {     public void Initialize(ITelemetry telemetry)     {         switch (telemetry)         {             case RequestTelemetry request when request.ResponseCode == "404":                 request.Success = true;                 break;         }     } } 
like image 70
gius Avatar answered Sep 19 '22 13:09

gius