By default System.Data.SqlClient
and Microsoft.Data.SqlClient
gets auto instrumented when you reference the Atatus.SqlClient package. You need to pass SqlClientDiagnosticSubscriber to the UseAtatus
method in case of ASP.NET Core as shown in the example below:
// Enable tracing of outgoing db requests
app.UseAtatus(Configuration, new SqlClientDiagnosticSubscriber());
The Configuration
input variable is the IConfiguration
instance passed to your Startup type.
Another method is by passing SqlClientDiagnosticSubscriber
to the Subscribe method.
// Enable tracing of outgoing db requests
Agent.Subscribe(new SqlClientDiagnosticSubscriber());
Please make sure that the code is called only once, otherwise the same database call would be captured multiple times.