Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TelemetryConfigration.Active deprecated #36394

Closed
skjelmo opened this issue Aug 2, 2019 — with docs.microsoft.com · 5 comments
Closed

TelemetryConfigration.Active deprecated #36394

skjelmo opened this issue Aug 2, 2019 — with docs.microsoft.com · 5 comments

Comments

Copy link

skjelmo commented Aug 2, 2019

TelemetryConfigration.Active is deprecated with ApplicationInsights SDK 2.11-beta1 as described here, so the first example under using config file
should maybe reflect that?

Could be done similar to how TelemetryProcessorChainBuilder is described here


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@SamaraSoucy-MSFT
Copy link
Contributor

@eivinskr Thank you for your feedback. I will investigate and get back to your shortly.

@SamaraSoucy-MSFT SamaraSoucy-MSFT self-assigned this Aug 2, 2019
@SamaraSoucy-MSFT
Copy link
Contributor

@eivenskr TelemetryConfigration.Active is being deprecated for .NET Core only. As is noted in the doc, using config files is not supported in .NET Core.

In the doc for .NET Core there is also a note that TelemetryConfiguration.Active is not supported for Core.

I will now proceed to close this thread. Please tag me if you need to discuss this further.

@skjelmo
Copy link
Author

skjelmo commented Aug 2, 2019

Ahh, I have two things I still find weird if you don't mind discussing it @SamaraSoucy-MSFT.

If you have other kind of application where you configure TelemetryConfiguration yourself - do not use TelemetryConfiguration.Active singleton

But as you mention, I don't get why that should be a problem if TelemetryConfiguration.Active is only being deprecated in .Net Core.

@SamaraSoucy-MSFT
Copy link
Contributor

The Application Insights package is used in both Framework and Core. The .NET Core SDK has it as a dependency.

TelemetryConfiguration.Active is a backup for when you don't have dependency injection available. Think of it as a default implementation that can be used in simple scenarios. In the doc example, Active avoids the complexity of setting up DI in .NET Framework. DI is built into .NET Core so there is no need to deal with the issues that can come with the Active singleton.

If you are setting up the configuration somewhere else, like through DI, using Active creates a second instance of the configuration and can cause conflicts. This is exactly the problem that is happening in Core apps.

@skjelmo
Copy link
Author

skjelmo commented Aug 5, 2019

Thank you for clearing up the confusion!

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

No branches or pull requests

3 participants