Search code examples
azureazure-application-insights

Filter out successful dependencies from AppInsight


I have created the following TelemetryFilter:

    public class TelemetryFilter : ITelemetryProcessor
    {
        private ITelemetryProcessor Next { get; set; }
        public TelemetryFilter(ITelemetryProcessor next)
        {
            Next = next;
        }
        public void Process(ITelemetry item)
        {
            var dependency = item as DependencyTelemetry;
            if (dependency != null && dependency.Success == true) return;
            Next.Process(item);
        }
    }

And added TelemetryFilter to TelemetruyProcessors in ApplicationInsights.config. It works when I run the application on my machine but when it is deployed to test and production environments, dependencies are getting collected by Azure AppInsights. When I see them in Azure Portal they have the property Call status: true. Is Call status refers to dependency.Success? What's the best way to filter out all successful calls to decrease our AppInsights data ingress and lower our Azure bill?


Solution

  • I found that ApplicationInsights.config file wasn't set to be copied into the output folder by the build process. That's why it didn't work.