Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (45.3k points)

I'm using Azure Application Insights for a website (Azure App Service). On that, I'm using a clustered Umbraco setup and hangfire. These two alone keep hitting the database every minute and are flooding my 'App Insights'.

So my question is, how do I disable the SQL Dependency Tracker? I've had a look at the ApplicationInsights.config and couldn't find anything obvious. I can see Microsoft.ApplicationInsights.DependencyCollector which is probably responsible, but I don't want to remove all types of dependency telemetry, only sql.

Thanks

1 Answer

0 votes
by (16.8k points)

Best way is to use a Telemetry Processor in order to filter out certain types of dependency requests. 

Check out these resources below for information.

Sampling, filtering and pre-processing telemetry in the Application Insights SDK

Request filtering in Application Insights with Telemetry Processor

An example processor might look like this.

using Microsoft.ApplicationInsights.Channel;

using Microsoft.ApplicationInsights.Extensibility;

using Microsoft.ApplicationInsights.DataContracts;

public class NoSQLDependencies : ITelemetryProcessor

{

    private ITelemetryProcessor Next { get; set; }

    // Link processors to each other in a chain.

    public NoSQLDependencies(ITelemetryProcessor next)

    {

        this.Next = next;

    }

    public void Process(ITelemetry item)

    {

        if (IsSQLDependency(item)) { return; }

        this.Next.Process(item);

    }

    private bool IsSQLDependency(ITelemetry item)

    {

        var dependency = item as DependencyTelemetry;

        if (dependency?.DependencyTypeName == "SQL")

        {

            return true;

        }

        return false;

    }

}

Browse Categories

...