Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No SQL dependency telemetry after moving to Microsoft.Data.SqlClient

I am developing several ASP.NET web services that use SQL Server for storage and Azure Application Insights for telemetry. I was not getting full SQL command text in the dependency telemetry when running the services locally under IISExpress (although I did see stored procedure names when an SP was being called), so I followed the advice in the docs for this scenario, and migrated from System.Data.SqlClient to the new Microsoft.Data.SqlClient package.

Now I am not seeing any SQL dependency telemetry from any components that use Microsoft.Data.SqlClient. This is not the result I was hoping for.

Prior to the change, the sdkVersion in the dependency telemetry was "rddf:2.11.2-28447". The docs say I should see an "rddp:" prefix here, but since there is no longer any SQL telemetry, I don't have anything to check.

One service uses some code from Microsoft.AspNet.Identity.EntityFramework, which continues to use System.Data.SqlClient (not sure how to change that). SQL dependency telemetry is still being generated for these classes, but of course does not include the full command text, and still has the "rddf:" SDK version prefix.

What do I need to do to get SQL dependency telemetry that includes the full command text?

Some details:

  • .NET Framework 4.7.2
  • Microsoft.ApplicationInsights.Web 2.11.2
  • Microsoft.ApplicationInsights.DependencyCollector 2.11.2
  • Microsoft.Data.SqlClient 1.0.19269.1. Newer versions (1.1.x) require an update to Microsoft.IdentityModel.JsonWebTokens that I cannot take at this time.
like image 940
Bob Meyers Avatar asked Oct 26 '22 22:10

Bob Meyers


1 Answers

It cannot include the full sql command text if you're using Microsoft.Data.SqlClient 1.0.19269.1. There is an issue about that.

In my .net 4.7.2 web project, I'm using Microsoft.Data.SqlClient 1.1.0. The full sql command text can be included. The screenshot as below:

enter image description here

Other nuget packages I'm using:

Microsoft.ApplicationInsights.Web 2.11.0

Microsoft.ApplicationInsights.DependencyCollector 2.11.0

Microsoft.ApplicationInsights 2.14.0

like image 117
Ivan Yang Avatar answered Nov 15 '22 06:11

Ivan Yang