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

SqlClient instrumentation doesn't work for Microsoft.Data.SqlClient under .NET Framework #1597

Closed
mbakalov opened this issue Nov 20, 2020 · 3 comments · Fixed by #1599
Closed
Labels
bug Something isn't working

Comments

@mbakalov
Copy link
Contributor

mbakalov commented Nov 20, 2020

Using latest opentelemetry-dotnet, target net461 and use Microsoft.Data.SqlClient nuget package.

SQL activities are not captured.

EDIT: when submitting this issue I first incorrectly assumed the netfx Sql instrumentation relied on DiagnosticSource events, but that is not the case.

Microsoft.Data.SqlClient on netfx uses the WriteBeginExecuteEvent/WriteEndExecuteEvent methods that operate on the EventSource, similar to the System.Data.SqlClient on netfx.

The reason our instrumentation doesn't pick it up is because in Microsoft.Data.SqlClient this event source is named "Microsoft.Data.SqlClient.EventSource", but the instrumentation only listens to the "Microsoft-AdoNet-SystemData".

Note that we have tests for Microsoft.Data.SqlClient and when running against a docker instance of SQL Server on net461 they do actually fail.

cc @CodeBlanch

@mbakalov mbakalov added the bug Something isn't working label Nov 20, 2020
@mbakalov
Copy link
Contributor Author

Ah, looks like this is because the EventSource was actually renamed in Microsoft.Data.SqlClient, which was done in dotnet/SqlClient#399

So now it makes sense at least, means we need to support both EventSources.

@CodeBlanch
Copy link
Member

Thanks @mbakalov! I have noticed the net461 tests failing recently but haven't had a chance to look into it. Are you going to submit a PR?

@mbakalov
Copy link
Contributor Author

@CodeBlanch - yes, will try to do it tomorrow am!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants