Install the agent
Install the Atatus.AspNetFullFramework package in your application.
By installing Atatus.AspNetFullFramework package, auto instrumentation for ASP.NET (Full .NET Framework) happens automatically. Make sure to add a reference to the package in your
Web.config
file, and then compile and deploy your application.copy# Package Manager Install-Package Atatus.AspNetFullFramework -Version 2.0.1 # .NET CLI dotnet add package Atatus.AspNetFullFramework --version 2.0.1
Below is a sample
Web.config
configuration file for a ASP.NET application.copy<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="Atatus:AppName" value="YOUR_APP_NAME" /> <add key="Atatus:LicenseKey" value="YOUR_LICENSE_KEY" /> </appSettings> </configuration>
Ensure you have access to the application source code and install the Atatus.AspNetFullFramework package. Reference the Atatus.AspNetFullFramework in your application's
Web.config
file by adding the AtatusModule IIS module:copy<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <modules> <add name="AtatusModule" type="Atatus.AspNetFullFramework.AtatusModule, Atatus.AspNetFullFramework" /> </modules> </system.webServer> </configuration>
Recompile your application and deploy it.
Use AtatusModule
By default the AtatusModule instantiates the APM agent on the first initialization. In certain cases, in order to apply filters during application start, you may want to control the agent instantiation. You can do that by using the CreateAgentComponents()
method that is exposed by Atatus Module. Calling this would return the agnet components configured to work with ASP.NET Full Framework, using which you can then instantiate the agent.
For example, you can add SqlClientDiagnosticSubscriber()
to the agent in the application start (Global.asax.cs):
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
var agentComponents = AtatusModule.CreateAgentComponents();
Agent.Setup(agentComponents);
// add capturing of SQL client calls
Agent.Subscribe(new SqlClientDiagnosticSubscriber());
// other application startup e.g. RouteConfig, etc.
}
}