Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jiimaho/ce4e97fd72070c85989cc0ea5e45eb9a to your computer and use it in GitHub Desktop.
Save jiimaho/ce4e97fd72070c85989cc0ea5e45eb9a to your computer and use it in GitHub Desktop.
public class IgnoreRequestPathsTelemetryProcessor : ITelemetryProcessor
{
private readonly ITelemetryProcessor _next;
public IgnoreRequestPathsTelemetryProcessor(ITelemetryProcessor next)
{
_next = next;
}
public void Process(ITelemetry item)
{
if (item is RequestTelemetry request &&
(request.Url.AbsolutePath.StartsWith("/static/") ||
request.Url.AbsolutePath.StartsWith("/img/") ||
request.Url.AbsolutePath.StartsWith("/hc") ||
request.Url.AbsolutePath.StartsWith("/login/img/") ||
request.Url.AbsolutePath.StartsWith("/swagger/")))
{
return;
}
_next.Process(item);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment