Installation (legacy agent)
The following content pertains to
AppOptics agents are no long receiving updates. The new SolarWinds Observability libraries are regularly updated with new features and improvements. If you are still relying on the AppOptics agents and your components are supported by the new libraries, consider migrating to SolarWinds Observability.
If you have already transitioned to the new SolarWinds Observability Nodejs Library, see the SolarWinds Nodejs Library documentation for installation information.
SolarWinds Observability libraries are not compatible with AppOptics agents. Do not use a mix of SolarWinds Observability libraries and AppOptics agents to instrument applications that are part of a distributed trace.
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.
Installing the Agent
The agent requires a C++ addon package called @appoptics/apm-bindings
.
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.
Install steps
The agent can be installed via the standard npm
command, for example:
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). See NPM install failed with "cannot run in wd" in Stack Overflow public questions. For example:
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:
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:
// 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:
npm uninstall --save appoptics-apm
Heroku
To attach the AppOptics add-on to your Heroku application, refer the SolarWindsAppOptics add-ons instructions (© Salesforce.com, available at https://devcenter.heroku.com/, obtained on October 26, 2020). 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.
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.