Download PDF
Download page Configure Transaction Analytics for Node.js, PHP, and Python Applications.
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.
Analytics data cannot be collected from PHP CLI programs.
To collect Transaction Analytics from the PHP Agent:
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 onlocalhost
and listens to Port 9090:agent.analyticsHostName = localhost agent.analyticsPort = 9090
CODEAdd the following variables with the proper values to point to your Analytics Agent:
agent.analyticsHostName = <analyticsHostName> agent.analyticsPort = <analyticsPort>
CODEThe 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.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()
CODEIf the return value is not stored in any variable, it displays as
null
in both snapshot and Analytics data.
Configure Analytics for Python Applications
- In Transaction Analytics - Configuration, click Enable Analytics to enable Analytics on a Python application.
- To the right of Business Transactions, click Enable Analytics to enable Analytics on any Business Transaction(s) in the application.
- 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>
CODEThe default value of the host is
localhost
and port is9090
.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:
Obtain the root certificate of the CA authority that signed the Analytics Agent certificate.
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>
CODEPython 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