Application Insights is an awesome monitoring tool, but it considers all 4xx and 5xx HTTP Status Codes as errors, and when writing REST APIs some of these codes have a special meaning and are not errors. A 404 (Not found) response from a REST API usually means there are no results for a given action, not that you have hit a non-existent page.
So, how do we tell Application Insights to ignore those 404s? Simple: we write what is called a Telemetry processor.
We then need to add this processor to our Application Insights telemetry configuration, for this we’ll use a helper class:
And we call it in our
Now we will not see those 404s as errors in Application Insights.