Alexander Zhidkov
Alexander Zhidkov

Reputation: 581

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?

Upvotes: 1

Views: 950

Answers (2)

Alexander Zhidkov
Alexander Zhidkov

Reputation: 581

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.

Upvotes: 0

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4786

Filter out all successful dependencies:

you can initialize the filter in code. In a suitable initialization class,

AppStart in Global.asax.cs, insert your processor into the chain:

var builder = TelemetryConfiguration.Active.DefaultTelemetrySink.TelemetryProcessorChainBuilder;

builder.Use((next) => new SuccessfulDependencyFilter(next));

// If you have more processors:

builder.Use((next) => new AnotherProcessor(next));

builder.Build();

Refer for filtering sampling & for request filtering

To Reduce Application Insights cost

You need to optimize Telemetry with Application Insights check here

Check here for some more methods to reduce Application insights cost

Upvotes: 1

Related Questions