Skip to content

[BUG] Unable to use telemetry initializer to filter calls to retrieve config from js.monitor.azure.com #2480

Description

Trying to cut down on the # of 3rd party dependency calls that get logged from our app to keep log volumes down, but ran into difficulties suppressing App Insights' calls to load its own config.

We wind up with at least one dependency call logged per page load for the following URL:
GET https://js.monitor.azure.com/scripts/b/ai.config.1.cfg.json

I tried adding a telemetry initializer to filter dependencies based on hostname, but it looks like the call to fetch the config is made & logged as soon as the ApplicationInsights object is created.

Since addTelemetryInitializer isn't called until after that, there's nothing to prevent the SDK from logging that initial request.

Steps to Reproduce

  • OS/Browser: Windows / Edge
  • SDK Version: 3.3.4
  • How you initialized the SDK:
const config: IConfiguration & IConfig = {
	connectionString: connectionString,

	enableAutoRouteTracking: true,
	enableAjaxPerfTracking: true,
	enableAjaxErrorStatusText: true,
	enableCorsCorrelation: true,

	// Monitor all AJAX calls
	maxAjaxCallsPerView: -1,

	// Whether or not to disable telemetry
	disableTelemetry: disableTelemetry,
};

// This triggers a fetch that gets logged as a dependency
const appInsights = new ApplicationInsights({
	config: config,
});
// Filter to exclude traffic is here
appInsights.addTelemetryInitializer(filterDependencyTracking);

const reactPlugin = new ReactPlugin();
appInsights.addPlugin(reactPlugin);

appInsights.loadAppInsights();

Expected behavior

All telemetry events get processed via the telemetry initializer as long as it's registered before calling loadAppInsights.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions