By default, the AppDynamics .NET Agent enables multi-threaded correlation for the following patterns on the Common Language Runtime (CLR) 4.x and later:

  • Task.Start
  • Task.Run
  • TaskFactory.StartNew

The .NET Agent also supports thread correlation for the following patterns which are disabled by default:

  • Thread.Start on the CLR 2.x and CLR 4.x
  • ThreadPool.QueueUserWorkItem on the CLR 2.x and CLR 4.x

In versions of AppDynamics prior to 4.3, for the .NET Agent, you did not need to configure correlation for ThreadPool.QueueUserWorkItem for the CLR 4 in the config.xml file. If you explicitly call ThreadPool.QueueUserWorkItem for the CLR 4, when you upgrade to the .NET Agent 4.5 from a previous version, you must enable the instrumentor for ThreadPool.QueueUserWorkItem on the CLR 4 in the config.xml file.

Configure Thread Correlation for .NET

Configure all instrumentation settings for the .NET Agent in the config.xml file. See Administer the .NET Agent

  1. Open the config.xml file for editing as an administrator. See 'Where to Configure Agent Properties' on Administer the .NET Agent
  2. Copy the code block below to a child element of the Machine Agent element. See Machine Agent Element

        <instrumentation>
            <instrumentor name="ThreadCorrelationThreadPoolCLR2Instrumentor" enabled="true"/>
            <instrumentor name="ThreadCorrelationThreadPoolCLR4Instrumentor" enabled="true"/>
            <instrumentor name="ThreadStartCLR2Instrumentor" enabled="true"/>
            <instrumentor name="ThreadStartCLR4Instrumentor" enabled="true"/>
        </instrumentation>
    
    CODE

    For example:

    <?xml version="1.0" encoding="utf-8"?>
    <appdynamics-agent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    ...
     <machine-agent>
        <!--Enable thread correlation-->
        <instrumentation>
            <instrumentor name="ThreadCorrelationThreadPoolCLR2Instrumentor" enabled="true"/>
            <instrumentor name="ThreadCorrelationThreadPoolCLR4Instrumentor" enabled="true"/>
            <instrumentor name="ThreadStartCLR2Instrumentor" enabled="true"/>
            <instrumentor name="ThreadStartCLR4Instrumentor" enabled="true"/>
        </instrumentation>
      </machine-agent>
    ...
    </appdynamics-agent>
    
    CODE

    The configuration syntax is enabled="true".

  3. Save the config.xml file.
  4. Restart the AppDynamics.Agent.Coordinator service.
  5. Restart instrumented applications for your changes to take effect.