-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Description
The following counters don't get updated when the async API is used (as opposed to the sync one):
- SaveChanges (flagged in Calls to
SaveChangesAsync
do not update theEntityFrameworkEventSource
values #23604) - Optimistic concurrency failures
- Execution strategy operation failure
In addition, the "Active DbContexts" counter is incorrect, since it's incremented only when the context's InternalServiceProvider is accessed, but decremented when disposing (regardless of whether InternalServiceProvider was accessed). Am moving the increment to occur in the constructor, /cc @ajcvickers
Note: I've spent some considerable time preparing automated tests for event counters, however:
- Due to the nature of event counters (captured out of process over networking), they seem like they will may be the source of a lot of flakiness and headaches.
- They're really slow (counters get emitted at most once per second).
- Need to be totally isolated from any other EF Core test activity, as the counters are application-global.
- The value we get from preventing regressions doesn't seem very high.
- FWIW neither ASP.NET nor runtime have tests for their event counters.
So am dropping this for now, but we can rediscuss if we feel we need to.