Loading

Entity Framework Core

Instrumentation can be enabled for Entity Framework Core by referencing Elastic.Apm.EntityFrameworkCore package and passing EfCoreDiagnosticsSubscriber to the AddElasticApm method in case of ASP.NET Core, as follows:

app.Services.AddElasticApm(new EfCoreDiagnosticsSubscriber());
		

or passing EfCoreDiagnosticsSubscriber to the Subscribe method

Agent.Subscribe(new EfCoreDiagnosticsSubscriber());
		

Instrumentation listens for diagnostic events raised by Microsoft.EntityFrameworkCore, creating database spans for executed commands.