Documentation forAppOptics

Install the Node.js Agent

The Node.js agent is distributed as the npm package appoptics-apm. Install the package, require it in your application, and automatically get visibility into the frameworks and components used by your application.

Dependencies

The agent compiles a C++ addon during install, thus you'll need to have the following on the system prior to installing the agent:

  • gcc version 4.7 and above
  • for node-gyp: make and python 2.x (version 2.7 is recommended)

Note that some systems may provide multiple python versions, in which case you would need to specify the correct package name for python 2.7.

On Debian/Ubuntu:

Copy
sudo apt-get install g++ make python

On RHEL/CentOS/Amazon Linux:

Copy
sudo yum install gcc-c++ make python

On Alpine:

Copy
$ sudo apk add g++ make python

Our C++ addon currently supports Linux only. The agent will install on other platforms such as OS X but will run in "no-op" mode where it does not emit trace data or metrics.

The C++ addon is compiled into a binary with system and Node.js version dependencies, so the installed agent package on one platform cannot just be copied onto a different platform; instead, the agent must be installed specifically on each different platform.

Get the Agent

The agent can be installed via the standard npm command, for example:

Copy
npm install --save appoptics-apm

you may need to use npm's --unsafe-perm option to work around the "cannot run in wd" error when npm install is run as the root user (which may be the default in a docker container). For example:

Copy
npm install --unsafe-perm --save appoptics-apm

Enabling the Agent

The agent requires a service key to connect to your account, and must be required into your application code.

Service key

The agent requires a service key to connect to your account, this is set via the APPOPTICS_SERVICE_KEY environment variable or the serviceKey configuration file property. When using the environment variable, make sure it is available in the environment where your application is running:

Copy
export APPOPTICS_SERVICE_KEY="api-token-here:your-service-name"

A service key is composed of an API token with write permissions and the name of the service you're installing on. Our onboarding flow provides the full service key, or check the API Tokens page to grab a token and fill the service name yourself.

Loading the agent

To load the agent into your application, require appoptics-apm in your entry point file before any other require() calls, below is an example with a simple express application:

Copy
// must be first require
require('appoptics-apm')
const express = require('express')
const app = express()
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(3000, () => console.log('Example app listening on port 3000!'))

You can find more troubleshooting information in the "Installation warning" section of the agent README file.

Removing the agent

Make sure your application entry point file no longer requires appoptics-apm, and then uninstall it with:

Copy
npm uninstall --save appoptics-apm

Heroku

Ensure that the AppOptics add-on is attached to your Heroku application, then follow the Node.js agent steps to install and enable the agent.

Azure App Service

Deploying applications with the AppOptics APM agent to Azure App Service on Linux has been tested using the vscode's Azure App Service extension, the azure CLI client "az", and the local git repository method. No special processing is required, but make sure that you don't change the default which is that the build is done by the deployment engine.

When the APM Integrated Experience is enabled, AppOptics shares a common navigation and settings with the other integrated experiences' products. How you navigate AppOptics and access its features may vary from these instructions. For more information, go to the APM Integrated Experience documentation.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.