Last active
March 13, 2017 19:27
-
-
Save patkleef/ad761348db9783e5789412b7f9a98ac8 to your computer and use it in GitHub Desktop.
Application Insights Blog - ApplicationInsightsNotFoundFilter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NotFoundFilter : ITelemetryProcessor | |
| { | |
| private ITelemetryProcessor Next { get; set; } | |
| public NotFoundFilter(ITelemetryProcessor next) | |
| { | |
| this.Next = next; | |
| } | |
| public void Process(ITelemetry item) | |
| { | |
| var request = item as RequestTelemetry; | |
| if (request != null && | |
| request.ResponseCode.Equals(((int)HttpStatusCode.NotFound).ToString(), StringComparison.OrdinalIgnoreCase)) | |
| { | |
| // To filter out an item, just terminate the chain: | |
| return; | |
| } | |
| // Send everything else: | |
| this.Next.Process(item); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment