This page describes how to configure Transaction Analytics and Data Collectors for Node.js, PHP, and Python 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 these variables with the proper values to point to your Analytics Agent:

analytics: {
    host: <analyticsHostName>,
    port: <analyticsPort>,
    ssl: <true || false> 
}
CODE

The Analytics Agent can be on the same host as the Node.js Agent or on a different host. See Install the Node.js Agent.

Configure Data Limits

You can also configure the Node.js Agent to set limits on data sent to the Analytics Agent with these properties correlated to environment variables.

Property Name

Description

Environment Variable

analyticsMaxSegmentSizeInBytesThe maximum size of a business transaction segment collected in an Analytics request. By default, the value is 0.1MB.APPDYNAMICS_ANALYTICS_MAX_SEGMENT_SIZE
analyticsMaxSegmentsPerRequestThe maximum number of segments per Analytics request. By default, the value is 16.APPDYNAMICS_ANALYTICS_MAX_SEGMENTS_PER_REQUEST
analyticsMaxMessageSizeInBytesThe size of a single request body sent to the Analytics Agent. By default, the value is 1MB.APPDYNAMICS_ANALYTICS_MAX_MESSAGE_SIZE

Your require statement should look similar to the following example 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 application name>',
    debug: false,
    tierName: '<Choose a tier name>',
    nodeName: '<Choose a node name>', // The Controller appends the node name with a unique number
    analyticsMaxSegmentSizeInBytes: 20,
    analyticsMaxSegmentsPerRequest: 20,
    analyticsMaxMessageSizeInBytes: 100,
    analytics: {
        host: 'localhost',
        port: 9090 },
    logging: {
        'logfiles': [
        {'root_directory': '/tmp/appd', 'filename': 'echo_%N.log', 'level': 'TRACE', 'max_size': 5242880, 'max_files': 10 },
        { 'root_directory': '/tmp/appd', 'filename': 'protobuf_%N.log', 'level': 'TRACE', 'max_size': 5242880, 'max_files': 10, 'channel': 'protobuf' }]
             }
});
CODE

Collect 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.

Configure Analytics for PHP Applications

Transaction Analytics Configuration

  1. In Transaction Analytics - Configuration, click the Enable Analytics checkbox to enable/disable Analytics on a PHP application.
  2. To the right of Business Transactions, click the Enable Analytics checkbox to enable/disable Analytics on any Business Transaction(s) in the application.

Analytics data cannot be collected from PHP CLI programs.

To collect Transaction Analytics from the PHP Agent:

  1. 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 Agent is installed. 
    By default, your .ini file contains the following configuration where your Analytics Agent is on localhost and listens to Port 9090:

    agent.analyticsHostName = localhost
    agent.analyticsPort = 9090
    CODE

    Add the following variables with the proper values to point to your Analytics Agent:

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

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

    You must set the node level setting analytics-dynamic-service-enabled=true for reporting analytics.

  2. (Optional) If you require to report analytics data after a specific number of data events/transactions or after a specific time interval, configure the PHP Agent by adding the following parameters in the .ini file:

    agent.analyticsReportingFrequency = <time in seconds>
    agent.analyticsEventThreshold = <number of analytics transaction recorded>
    CODE

    The default agent reporting frequency is 30 seconds and the default event threshold is 10K events/transactions.

  3. HTTP/Method Invocation Data collectors for Analytics must be enabled for both transaction snapshots and Transaction Analytics to report data from the PHP Agent.
    In order to collect the method return value with an MIDC, the value must be assigned to a variable.

    $ret = function()
    CODE

    If the return value is not stored in any variable, it displays as null in both snapshot and Analytics data.

Configure Analytics for Python Applications

  1. In Transaction Analytics - Configuration, click Enable Analytics to enable Analytics on a Python application.
  2. To the right of Business Transactions, click Enable Analytics to enable Analytics on any Business Transaction(s) in the application.
  3. For Controller versions <= 21.10, set the analytics-dynamic-service-enabled=true node property to report analytics.

    For details on how to add node properties, see Add a Registered Node Property.

The parent configuration is not supported for the analytics-dynamic-service-enabled property. You must set this property to each node to report transaction analytics.

Collect Transaction Analytics

To collect Transaction Analytics from the Python Agent, configure the Python Agent to send the default transaction data to the Analytics Agent:

  • Modify the Python Agent configuration file. 

    [services:analytics]
    host= <analyticsHostName>
    port= <analyticsPort>
    CODE

    The default value of the host is localhost and port is 9090.

    Or,

  • Set these environment variables:

    • APPDYNAMICS_ANALYTICS_HOSTNAME

    • APPDYNAMICS_ANALYTICS_PORT

For details about how to set the environment variables, see Python Agent Settings.

Enable SSL Between Python Agent and Analytics Agent

To enable SSL between Python Agent and Analytics Agent:

  1. Obtain the root certificate of the CA authority that signed the Analytics Agent certificate.

  2. Enable SSL and specify the path of the certificate file in the Python Agent configuration file. 

    [services:analytics]
    ssl= on
    ca-file=<path of the CA certificate file>
    CODE

    Python Agent accepts the certificate file in .pem format.

    If there are intermediate certificate authorities, specify the path of the chain of trust in place of the root certificate authority.

    Or,

    Set these environment variables:

    • APPDYNAMICS_ANALYTICS_SSL_ENABLED

    • APPDYNAMICS_ANALYTICS_CAFILE