Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Make removal of built-in modules possible #633

Closed
cijothomas opened this issue Apr 7, 2018 · 3 comments
Closed

Make removal of built-in modules possible #633

cijothomas opened this issue Apr 7, 2018 · 3 comments
Assignees
Milestone

Comments

@cijothomas
Copy link
Contributor

As an example,
DependencyCollectorTelemetryModule is injected into DI Container in a lazy way(https://github.com/Microsoft/ApplicationInsights-aspnetcore/blob/develop/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs#L142). This makes it difficult for customer to remove the module from the collection in the ConfigureServices method, as it wont be present yet.

Repro Steps

  1. Follow this steps and attempt to remove DependencyCollector module https://github.com/Microsoft/ApplicationInsights-aspnetcore/wiki/Dependency-Tracking-and-Performance-Counter-Collection#disabling-telemetry-module-services

Actual Behavior

DependencyCollector won't be removed.

Expected Behavior

DependencyCollector should be removed.

Version Info

SDK Version :
.NET Version :
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) :
OS :
Hosting Info (IIS/Azure WebApps/ etc) :

@cijothomas cijothomas self-assigned this Apr 7, 2018
@cijothomas cijothomas added this to the 2.3.0 milestone Apr 7, 2018
@cijothomas
Copy link
Contributor Author

Addressed via https://github.com/Microsoft/ApplicationInsights-aspnetcore/pull/632/files

Use the following lines in ConfigureServices() after the call to AddApplicationInsightsTelemetry() to remove DependencyTrackingTelemetryModule completely.

var dependencyTrackingService = services.FirstOrDefault<ServiceDescriptor>(t => t.ImplementationType == typeof(DependencyTrackingTelemetryModule));
if (dependencyTrackingService!= null)
{
 services.Remove(dependencyTrackingService);
}

@cijothomas cijothomas modified the milestones: 2.3.0, 2.3.0-beta1 Apr 10, 2018
@cijothomas
Copy link
Contributor Author

Might be worth to provide a even simpler way - like services.RemoveApplicationInsightsTelemetryModule() ??

@cijothomas
Copy link
Contributor Author

Also addressed via #645

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant