This topic explains how to configure Transaction Analytics and data collectors for Node.js and PHP Applications. 

Before You Begin

Make sure you have installed and configured the components described in Installing Agent-Side Components and, for on-premises, Custom Install and Events Service Deployment before attempting to configure Transaction Analytics.

Configure Analytics for Node.js

Collect Default Node.js Transaction Data

To configure the Node.js Agent to send the default transaction data to the analytics agent, modify the require statement in your application. Add the following variables with the proper values to point to your Analytics Agent:

analytics: {
    host: <analyticsHostName>,
    port: <analyticsPort>,
    ssl: <sslEnabled>
}

The Analytics Agent can be on the same host as the Node.js Agent, or on a different host. For more details on installing the Node.js Agent, see Install the Node.js Agent.

For example, your require statement should look similar to the following where your Analytics Agent is on localhost and listening on port 9090:

require("appdynamics").profile({
  controllerHostName: '<controller host name>',
  controllerPort: <controller port number>, 
  controllerSslEnabled: false,  // Set to true if controllerPort is SSL
  accountName: '<AppDynamics_account_name>',
  accountAccessKey: '<AppDynamics_account_key>', //required
  applicationName: 'your_app_name',
  tierName: 'choose_a_tier_name', 
  nodeName: 'choose_a_node_name',
  analytics: {
      host: 'localhost',
      port: 9090,
      ssl: false
 }});

To configure Analytics for Node.js using environment variables, see the Node.js Settings Reference.

Node.js Data Collectors

You can also collect additional data from your Node.js business transactions by using the Node.js API. To configure transaction analytics data collectors for Node.js, see txn.addAnalyticsData() in the Node.js Agent API Reference.

Configuring Analytics for PHP Agent 

  1. To configure the PHP Agent to send the default transaction data to the analytics agent, modify the .ini file, depending on the operating system under which your PHP is installed. Add the following variables with the proper values to point to your Analytics Agent:

    agent.analyticsHostName = <analyticsHostName>
    agent.analyticsPort = <analyticsPort>

    The Analytics Agent can be on the same host as the PHP Agent, or on a different host. For more details on installing the PHP Agent, see Install the PHP Agent.

    For example, your .ini file should contain the following where your Analytics Agent is on localhost and listening on port 9090:

    agent.analyticsHostName = localhost
    agent.analyticsPort = 9090
  2. HTTP/Method Invocation Data collectors for analytics must be enabled for both Transaction snapshots and Transaction Analytics for data to be reported from the PHP agent.
  3. In order to collect method return value with an MIDC, the value must be assigned to a variable.
    $ret = function()
    If the return value is not stored in any variable then it will be seen as null in both snapshot and Analytics data.
  4. Analytics data cannot currently be collected from php CLI programs.