-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Expose event counters for performance metrics #18016
Comments
Hi @roji I like the initial proposal for :
But it could be very intersting to have dynamic counters to see query execution time for specify queries (¿annotated with Tag, with a new metadata?). These dynamic counters allow us verify how "main" queries are working. The image below is a sample of dynamic counters ( the first two [darkmode] and [matchscore] ) Besides, I'd also like to see counter for most of the EventId,RelationEventId,CoreEventId warnings like query client evaluations, execution strategy retrying, optimistic concurrency exceptions.. Thanks Unai |
I'm not 100% sure, but from what I saw the design for event counters doesn't really allow for dynamic counters - you typically define a fixed set of counters that your component emits. What you're describing may be a better fit for a logging consolidation solution, which would ingest logs produced by EF Core (via DiagnosticSource), correlate events and produce the information you want. But it's worth thinking about.
Client evaluation is (mostly) no longer supported. Retries could be an interesting idea (added to the list), More generally, as I noted above, EF Core already generates lots of information via DiagnosticSource. Event counters are definitely not meant to replace that or mirror it - they're supposed to be a small set of well-defined standard statistics that can be emitted quickly and efficiently, and tracked in real time. |
Hi @roji
I do dynamic counters in my code and works well! I hope is supported :-) https://github.com/Xabaril/Esquio/blob/master/src/Esquio/Diagnostics/EsquioEventSource.cs |
Interesting idea, not sure it's 100% supported/safe but worth taking a look! Thanks. |
Also, opening connections and using transactions would be useful, but should probably be at the ADO.NET level. |
Suggestion by @AndriySvyryd: counter for the number of service providers, to help locate problematic cases. We already have a warning for this case, and it might not be that valuable to have a perf counter for something that is essentially "boolean" (is your program working correctly or not), but something to think about. |
.NET Core 3.0 introduced event counters, which are a way to efficiently expose performance metrics from the application. For example, the .NET runtime emits various GC, CPU and JIT statistics. These can be read via
dotnet counters
.Here is what we intend to implement for 5.0:
Other counter ideas have been moved out to #21931
The text was updated successfully, but these errors were encountered: