SqlClientDiagnosticListener - change how we measure duration
See original GitHub issue- Currently we use
Statistics.ExecutionTime
inSqlClientDiagnosticListener
to get the duration of the given span for a given sql call. - This value seems to be an aggregated value of multiple statements - I don’t fully understand how it’s aggregated yet, but as it seems it’s not a 1-1 mapping to spans we generate. Maybe this part needs to be researched and understood a little bit better.
Suggestion for the fix:
- Let’s just rely on the internal timing of our
Span
type. So instead of getting the duration via the diagnostic source listener, we can just measure it as we do for spans by default.
If someone picks this up: please also try to add a test for this.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
entity framework - Logging query duration with EF Core
Ideally I want to keep a total of the duration of all queries performed through a request and have the total in milliseconds...
Read more >Using the DiagnosticSource in .NET Core: Theory
Thus, we can now measure the execution time of all queries to the database from our application, with virtually no change to the...
Read more >DiagnosticSource and DiagnosticListener
This walkthrough shows how to create a DiagnosticSource event and instrument code with System.Diagnostics.DiagnosticSource.
Read more >Modern Web Development with ASP.NET Core 3 Second ...
Spend less time learning and more time coding with practical eBooks and Videos ... modularity in everything: the transparent way by which we...
Read more >Third Party Software Disclosures
Below is a list of disclosures and disclaimers in connection with our incorporation of certain open-source licensed software into its services. Notwithstanding ...
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 FreeTop 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
Top GitHub Comments
Ok, I reproduced locally with a query like
SELECT getdate();WAITFOR DELAY '00:00:01.000';
which showed the issue nicely. I’ll setup something along those lines, with a shorter delay.Hi, I’m having a look at the fix this week.
As to why it’s aggregated: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/provider-statistics-for-sql-server