No SQL dependency telemetry after moving to Microsoft.Data.SqlClient
Asked Answered
C

1

7

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.
Cuckooflower answered 21/5, 2020 at 15:36 Comment(4)
Hello, if the answer is helpful, could you please accept it as answer? Thanks.Vuong
You can also follow the instructions in this github issue.Vuong
Problem is still there with Microsoft.Data.SqlClient 2.0Handtomouth
Works well with Microsoft.Data.SqlClient 1.1.3Handtomouth
V
2

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

Vuong answered 26/5, 2020 at 2:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.