Introduce a diagnostics event pair for query execution
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
In EF's events/diagnostics system, we have an event pair for SaveChanges in core ([CoreEventId.SaveChangesStarting/Completed](https://github.com/dotnet/efcore/blob/main/src/EFCore/Diagnostics/CoreEventId.cs#L57)), but we're missing a similar pair for (LINQ) query execution. We've got various events around query execution (QueryExecutionPlanned, QueryCompilationStarting, QueryCanceled), but we're missing a simple QueryExecutionStarting/Completed pair.
EF already has lower-level command execution events, but those are at a different level. For one thing, a higher-level query event would contain the string representation of the LINQ query, rather than the SQL, which could be very useful for users to understand exactly which queries are being traced. Also, note that a single EF LINQ query can involve more than one lower-level command (split query); this could be a reason for users to track higher-level query execution at the EF level, rather than just lower-level "command executed" events.
When designing this, think about SQL queries, and in general go over our current query events to make sure everything makes sense.
Contributor guide
Assessment
This issue has not been assessed yet.