Install NodeJS

The Nudge Node.js agent allows you to correlate application traces and performance metrics in order to quickly identify performance bottlenecks and problematic service calls. *The Node.js agent can monitor applications started using commands such as:

node app.js
keystone app.js
etc...

To monitor NodeJS applications, Nudge APM provides a probe composed of two integrated elements :

nodejs

There are four steps to installing a probe on a NodeJS application:

  1. Application declaration in the Nudge APM interface
  2. Agent installation on the Windows/Linux server
  3. Agent configuration by modifying the configurationAgentNodeJS.ini file in its root folder.
  4. Checks

Application declaration

Install NodeJS Agent

From the NPM package

From ZIP file

The 3 installation files contain a token that allows you to download and install all packages, including OpenTelemetry, dedicated to the NodeJS agent.

⚠️ Note -> Under docker, the following lines are required for the token to be taken into account during package installation by > npm i

RUN apt install -y git
RUN apt install -y util-linux
RUN apt install -y make gcc g++ python3
RUN git config --global url."https://github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@github.com/".insteadOf "ssh://git@github.com/"
RUN npm install

NodeJS Agent configuration

Environment variables take precedence over the values of the configuration file parameters.

The advantage of modifying the configuration file is that for certain parameters, it is not necessary to restart the agent.

⚠️Retrieve the application key supplied by NUDGE when it was declared in the GUI, and paste its value into the [Nudge]app_id field.

⚠️The url for directing metrics to the NUDGE collector must be set to [Nudge]url.

⚠️The path of the NUDGE collector must be set in the [Nudge]pathCollect field. nodejs

Launching the agent with your application

If you launch your application as follows:

node "./server.js"

From the NPM package: The agent is installed in the /node_modules folder of your application.

To launch the agent in NPM package format, for example:

node -r agent.nodejs.nudge [app.js]

From the ZIP file: The agent is outside your application

To launch the agent in ZIP format, add the agent entry point as follows:

node -r "[.path to NodeJS agent]/agent_Nudge.js" to your application's startup script. 

You will use the “-require” or “-r” flag, which injects the NodeJS agent as follows:

node -r "[.path to NodeJS agent]/agent_Nudge.js” “./server.js"

It is still possible to inject the NodeJS agent by inserting the following line into your application’s entry point file.

require("[.path to NodeJS agent]/agent_Nudge.js");

If you encounter any difficulties during installation, please do not hesitate to contact us: support@atakama-technologies.com