Add Tracing in SqlClient
See original GitHub issueSqlClient doesn’t have any tracing in .Net Core. All the Bid Tracing API calls were removed during the port to Core.
One of the options is to use EventSource to emit traces during runtime.
Something similar was done by @stephentoub in System.Data.Common
.
Ref: https://github.com/dotnet/corefx/blob/master/src/System.Data.Common/src/System/Data/Common/DataCommonEventSource.cs
cc @corivera
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:18 (11 by maintainers)
Top Results From Across the Web
Enable event tracing in SqlClient - ADO.NET Provider for ...
Start PerfView and run Collect > Collect from the menu bar. · Configure the trace file name, output path, and provider name. ·...
Read more >Tracing System.Data.SQLConnection (SqlClient)
I'm writing a .Net application with db connection and queries. Using Syste.Data.SqlClient. I'd like to trace each sql executed by my application ...
Read more >SQL*Net tracing tips
STEP 1: Make a SQL*net trace file directory on the client machine called c:\trace. STEP 2: Add the following lines to your sqlnet.ora...
Read more >Tracing .NET Applications Easily With OpenTelemetry
In this article, we take a look at tracing in .NET applications, starting with the auto-instrumentation libraries and then custom traces.
Read more >Tracing SQL queries with the X-Ray SDK for .NET
You can execute the query asynchronously by using the ExecuteReaderAsync method. Example Controller.cs - SQL client instrumentation (asynchronous). using Amazon ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing issue since EventSource tracing is now added to SqlClient.
It does seem that both styles of tracing may be relevant, although it also seems that there is considerable overlap in what they provide, and I personally still don’t have a 100% clear picture of which should be used for what.
Regardless, what would be really great is some sort of quick spec/writeup on which events you’re planning to emit and when, before implementation. That would allow us to have a more concrete conversation about it possibly align across different ADO providers.
Note: in addition to https://github.com/dotnet/corefx/issues/21160, https://github.com/dotnet/corefx/issues/29534 is an additional issue I filed at the time. tl;dr SqlCient’s current implementation of DiagnosticSource seems like it doesn’t really follow best practices. I understand that the priority here is to bring over what exists from Core to Framework and not to change things, but this could also be a good moment to rethink the DiagnosticSource support itself. If you’re willing to do this, I’d be happy to work together and produce a spec.