6

We can no longer see the actual SQL queries being executed in Application Insights after we had upgraded our web apps to .Net Core 3.1. We left the EF Core at version 2.2 due to some serious performance issues with EF Core 3.x, so not sure if that has anything to do with that? All we see now is just the target DB details:

enter image description here

Prior to that we were on AspNetCore 2.2 with EF Core 2.2 and everything was working fine, Application Insights was showing us the actual SQL statements being executed.

We've tried the suggestions form Microsoft here, which suggested to add the Microsoft.Data.SqlClient nuget package to the project, but that did absolutely nothing.

We've also tried turning on the "Application Insights -> Sql Commands" option in our App Service, but that did nothing either.

enter image description here

Does anyone have any suggestions on how to get this working again?

Thanks

EDIT:

Nuget packages we are referencing:

enter image description here

6
  • Does it work locally? and also please share us the .csproj file to see which packages you're using. Commented May 27, 2020 at 6:42
  • No, it doesn't work locally either. Commented May 28, 2020 at 2:55
  • please share us the .csproj file to see which packages you're using. Commented May 28, 2020 at 2:55
  • Done. Edited the post Commented May 28, 2020 at 3:01
  • But I cannot see Microsoft.Data.SqlClient nuget package. Commented May 28, 2020 at 3:02

2 Answers 2

9

I believe this is because SQL command collection is off by default from version 2.14 onwards. It can be enabled with:

services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module. EnableSqlCommandTextInstrumentation = true; });

More information here: https://github.com/microsoft/ApplicationInsights-Announcements/issues/28

Sign up to request clarification or add additional context in comments.

Comments

5

It seems that it's an issue about the latest version of Microsoft.ApplicationInsights.AspNetCore 2.14.0. I can repro the issue in 2.14.0, but it works when I downgrade it to 2.12.0.

The test result with using Microsoft.ApplicationInsights.AspNetCore 2.12.0:

enter image description here

1 Comment

Simply magical! Thanks Ivan! I've tried it with ver. 2.12.2 and it worked. I didn't even have to add the Microsoft.Data.SqlClient nuget package. We'll just have to wait until they fix up this issue in the later versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.