Created
July 17, 2017 01:20
-
-
Save debugthings/b082670dac4f468a5aa04abd9dd6c367 to your computer and use it in GitHub Desktop.
Filter out request telemetry that is not to my hostname
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
| using Microsoft.ApplicationInsights.Channel; | |
| using Microsoft.ApplicationInsights.Extensibility; | |
| using System; | |
| public class NotMyHostNameFilter : Microsoft.ApplicationInsights.Extensibility.ITelemetryProcessor | |
| { | |
| private ITelemetryProcessor Next { get; set; } | |
| private bool parsed = false; | |
| public string ExceptionToFilter { get; set; } | |
| public NotMyHostNameFilter(ITelemetryProcessor next) | |
| { | |
| this.Next = next; | |
| } | |
| public void Process(ITelemetry item) | |
| { | |
| if (item is Microsoft.ApplicationInsights.DataContracts.RequestTelemetry) | |
| { | |
| var request = item as Microsoft.ApplicationInsights.DataContracts.RequestTelemetry; | |
| if (!request.Url.Host.Equals("www.debugthings.com", StringComparison.CurrentCultureIgnoreCase)) | |
| { | |
| // If this is not for my server www.debugthings.com then return | |
| return; | |
| } | |
| } | |
| this.Next.Process(item); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment