Skip to content

Issues with event counters #23630

@roji

Description

@roji

The following counters don't get updated when the async API is used (as opposed to the sync one):

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.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions