Configure Transaction Analytics for Node.js, PHP and Python Applications
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>
}
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 |
|---|---|---|
analyticsMaxSegmentSizeInBytes
| The maximum size of a business transaction segment collected in an Analytics request. By default, the value is 0.1MB. |
APPDYNAMICS_ANALYTICS_MAX_SEGMENT_SIZE
|
analyticsMaxSegmentsPerRequest
| The maximum number of segments per Analytics request. By default, the value is 16. |
APPDYNAMICS_ANALYTICS_MAX_SEGMENTS_PER_REQUEST
|
analyticsMaxMessageSizeInBytes
| The 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' }]
}
});
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
- In Transaction Analytics - Configuration, click the Enable Analytics checkbox to enable/disable Analytics on a PHP application.
- To the right of Business Transactions, click the Enable Analytics checkbox to enable/disable Analytics on any Business Transaction(s) in the application.
Configure the PHP Agent to send the default transaction data to the Analytics Agent. Modify the
.inifile depending on the operating system under which your PHP Agent is installed.By default, your.inifile contains the following configuration where your Analytics Agent is onlocalhostand listens to Port 9090:agent.analyticsHostName = localhost agent.analyticsPort = 9090Add the following variables with the proper values to point to your Analytics Agent:agent.analyticsHostName = <analyticsHostName> agent.analyticsPort = <analyticsPort>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=truefor reporting analytics.- (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
.inifile:agent.analyticsReportingFrequency = <time in seconds> agent.analyticsEventThreshold = <number of analytics transaction recorded>The default agent reporting frequency is 30 seconds and the default event threshold is 10K events/transactions.
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.
If the return value is not stored in any variable, it displays as null in both snapshot and Analytics data.$ret = function()
Configure Analytics for Python Applications
Collect Transaction Analytics
-
Modify the Python Agent configuration file.
[services:analytics] host= <analyticsHostName> port= <analyticsPortNote: The default value of the host islocalhostand port is9090.Or,
-
Set these environment variables:
-
APPDYNAMICS_ANALYTICS_HOSTNAME -
APPDYNAMICS_ANALYTICS_PORT
-
Enable SSL Between Python Agent and Analytics Agent
To enable SSL between Python Agent and Analytics Agent: