-
Notifications
You must be signed in to change notification settings - Fork 295
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 SQL dependency calls logged with Microsoft.Data.SqlClient 3.0.0 #2346
Comments
@TimothyMothra Could you take a look at the repro? Ms.Data.Sql 3.0.0 is a major version bump, so technically it may have some breaking changes affecting us. |
Hey all! I took a look at this and issue is likely due to PR #897 in SqlClient. They've changed the event source quite significantly. Instead of writing event like this: [Event(BeginExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)]
internal void BeginExecute(int objectId, string dataSource, string database, string commandText)
{
if (Log.IsExecutionTraceEnabled())
{
WriteEvent(BeginExecuteEventId, objectId, dataSource, database, commandText);
}
} It is now doing this instead: internal void TryBeginExecuteEvent(int objectId, Guid? connectionId, string commandText, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
{
if (Log.IsExecutionTraceEnabled())
{
BeginExecute(GetFormattedMessage(SqlCommand_ClassName, memberName, EventType.INFO,
string.Format("Object Id {0}, Client Connection Id {1}, Command Text {2}", objectId, connectionId, commandText)));
}
}
// ...
[Event(BeginExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Start)]
internal void BeginExecute(string message) =>
WriteEvent(BeginExecuteEventId, message); So we just get a text message now instead of DataSource/Database/CommandText. Not sure about the best way to deal with this, probably we should see if the SqlClient team could change it back to more structured logging - not even getting server/db values is unfortunate! |
@kiwiant - yeah, the netcore While on netfx it only uses the The netcore instrumentation knows to hook into the listener and continues to work ok. Thanks! |
This is still happening with version Microsoft.Data.SqlClient 3.0.1 and .net fw 4.8.1. Is there any workaround to fix this? Thanks |
@pmgallo - it got fixed for the upcoming 4.0.0 version and should be available in the preview releases (https://github.com/dotnet/SqlClient/releases) at least. Thanks! |
Hi @mbakalov, Thanks for your response. I tried the version 4.0.0-preview3.21293.2 and it works as expected. It'll do for now Thanks again! Regards |
closing this as it has been fixed in SqlClient v4 |
net48
Microsoft.Data.SqlClient 3.0.0
Microsoft.ApplicationInsights.* 2.17.0
Zero SQL dependency calls are logged when Microsoft.Data.SqlClient 3.0.0 is used. Roll back to 2.1.3 all good. Upgrade to Microsoft.Data.SqlClient 3.0.0 and no SQL dependencies logged. Everything else is the same (config, code, packages).
.NET Core is unaffected.
Sounds like a new version of issue #2032.
WebApplication1.zip
The text was updated successfully, but these errors were encountered: