Profiler chaining for the .NET Core agent
You can use profiler chaining to run the .NET Core agent alongside another .NET Core APM profiler.
The Contrast .NET Core agent is tested and proven to be compatible with the following profiling tools, given the combination of runtime, deployment type, and OS:
Profiling tool | Versions tested | .NET Core runtime | Third-party profiler deployment type | OS |
---|---|---|---|---|
AppDynamics | 21.8.1 | 6.0 | Installed, Nuget Package | Windows |
Dynatrace One Agent | 1.253.245 | 6.0 | Installed | Windows, Linux |
New Relic | 8.23.107 | 6.0 | NuGet Package | Windows, Linux |
Riverbed SteelCentral Aternity APM | 12.9.0 | 6.0 | Installed | Windows |
Datadog | 2.35.0 | 6.0 | Installed, NuGet Package | Windows, Linux |
Note
The agent is likely compatible with other profiling tools if those tools follow the conventions of the CoreCLR Profiling API and do not make assumptions about the profiling environment.
Chaining is enabled by default and can be disabled by setting agent.dotnet.enable_chaining
to false
.
agent: dotnet: enable_chaining: false
Automatic (Windows and IIS)
When using the .NET Core installer for IIS, the installer configures chaining automatically for all hosted .NET Core applications.
Install the third-party agent first (recommended), then the Contrast .NET Core agent.
Restart the IIS workers (by default, this is done automatically by the agent installer). On restart, the Contrast .NET Core agent automatically detects the presence of other profiling tools registered with IIS and configures the environment to load both the Contrast .NET Core agent profiler and the third-party profiler.
Automatic (Linux)
Under Linux, automatic chaining may be configured by setting the LD_PRELOAD
environment variable:
LD_PRELOAD=<path to the extracted Contrast files>/runtimes/linux-x64/native/ContrastChainLoader.so
For example, if the Contrast agent was extracted to /contrast
, then the following would setup chaining automatically.
LD_PRELOAD=/contrast/runtimes/linux-x64/native/ContrastChainLoader.so dotnet ./HelloWorld
Some APM profilers already set LD_PRELOAD
(e.g. Dynatrace). In this case, ensure the Contrast module is loaded first - separate LD_PRELOAD
are delimited by colons :
. For example:
LD_PRELOAD=/contrast/runtimes/linux-x64/native/ContrastChainLoader.so:/<path to Dynatrace>/liboneagentproc.so dotnet ./HelloWorld
Note
When running under Kubernetes, the Contrast Agent Operator will automatically setup chaining and is the preferred route to add agents to existing Kubernete workloads.
Manual
Chaining may need to be be manually setup, for example, in the following environments:
Hosted outside of IIS.
Environments that use the third-party agent's Nuget package (rather than the installed agent).
Note
Chaining with the Dynatrace agent is only supported using the automatic options above.
Replace the CLR environment variables for the profiling tool with CONTRAST_CCC_CORECLR versions. Any of these names should be transformed:
Change this
To this
CORECLR_PROFILER
CONTRAST_CCC_CORECLR_PROFILER
CORECLR_PROFILER_PATH
CONTRAST_CCC_CORECLR_PROFILER_PATH
CORECLR_PROFILER_PATH_32
CONTRAST_CCC_CORECLR_PROFILER_PATH_32
CORECLR_PROFILER_PATH_64
CONTRAST_CCC_CORECLR_PROFILER_PATH_64
Then add the agent manually.