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

No longer depend on Obsolete AppInsights APIs #7745

Merged
merged 1 commit into from
Dec 11, 2019
Merged

Conversation

xavierdecoster
Copy link
Member

@xavierdecoster xavierdecoster commented Dec 6, 2019

This PR updates the Gallery (and the jobs within the solution) to use the new Application Insights initialization logic introduced in ServerCommon 2.60.0 and NuGet.Jobs (current dev branch).

Goal is to move off obsolete AppInsights APIs, such as TelemetryConfiguration.Active.

In doing so, some legacy code and static classes required refactoring. Work in progress, but opening the PR already to collect feedback early on.

Also needs to consume a to-be-released update of NuGet.Services.Logging (PR pending)

@@ -127,7 +126,6 @@ protected void ConfigureGalleryServices(IServiceCollection services, IConfigurat
services.AddScoped<IDeleteAccountService, DeleteAccountService>();

services.AddScoped<IUserService, AccountDeleteUserService>();
services.AddScoped<ITelemetryClient>(sp => { return TelemetryClientWrapper.Instance; });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already configured here.


ApplicationInsightsConfiguration applicationInsightsConfiguration;

if (heartbeatIntervalSeconds > 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that ApplicationInsightsConfiguration is initialized twice. Here and in DefaulyDependenciesModule. Why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering the same thing, but didn't get to digging into it more until now.

The OwinStartup class loads the DefaultDependenciesModule through a call to app.UseAutofacInjection here, which in turn calls builder.RegisterAssemblyModules(currentAssembly); here.

My thinking is that we should consolidate everything within DefaultDependenciesModule and remove additional telemetry configuration from OwinStartup.

Copy link
Contributor

@skofman1 skofman1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

}
}
// Register the ILoggerFactory and configure AppInsights.
var applicationInsightsConfiguration = ConfigureApplicationInsights(configuration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applicationInsightsConfiguration [](start = 16, length = 32)

Does this override the configuration we have in a applicationinsights.config? One important thing we configured is not to sample: https://docs.microsoft.com/en-us/azure/azure-monitor/app/sampling

Please verify that we don't get sampling back with this change. I think looking at the runtime config with debugger should be sufficient.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first thing that ApplicationInsights.Initialize does, is reading the applicationinsights.config file.

I explicitly asked about this before making the change in ServerCommon.
See the code comment here and my question on AI issue tracker here.

I will verify sampling at runtime to be sure.

Copy link
Member

@joelverhagen joelverhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that telemetry flows as expected in the NuGetGallery based jobs and services.

@xavierdecoster xavierdecoster force-pushed the dev-ai-init branch 2 times, most recently from 8fa9940 to 8c95215 Compare December 10, 2019 20:48
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

Successfully merging this pull request may close these issues.

4 participants