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

Update the article to reflect the new ways of adding a TelemetryInitializer #4

Closed
JoanComasFdz opened this issue Feb 3, 2021 · 4 comments

Comments

@JoanComasFdz
Copy link

JoanComasFdz commented Feb 3, 2021

Hi,

Microsoft has changed how TelemetryInitializers have to be added:

Old way: TelemetryConfiguration.Active.TelemetryInitializers.Add(new MyTelemetryInitializer());

New way: services.AddSingleton<ITelemetryInitializer>(new RoleNameInitializer("my-service-name"));

Source: microsoft/ApplicationInsights-dotnet#1152

It would be great if you could update the article (https://vincentlauzon.com/2019/01/23/azure-application-insights-role-name-nuget-package/) with the new info.

@vplauzon
Copy link
Owner

vplauzon commented Feb 8, 2021

Good point. Let me try to do that.

@vplauzon
Copy link
Owner

vplauzon commented Feb 8, 2021

Done. Thank you Joan!

@adambielecki-landmark
Copy link

In terms of unit tests the code that is using injected telemetry client through the method AddApplicationInsightsTelemetry() how can we mock telemetry client? What would be recommended best practice?
Thanks.

@vplauzon
Copy link
Owner

Good question. I would recommend directing it to Stack overflow: https://stackoverflow.com/search?q=application+insights

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

No branches or pull requests

3 participants