Skip to main content

Installation of the Node.js agent

To use the WhaTap monitoring service, after Sign in, create a project and install the agent to the target server. For more information about registration as a member, see the following.

To use the Node.js monitoring service, the monitoring agent must be installed on the monitored application. For installation, use NPM (Node Package Manager).

  • Install the WhaTap agent module in the active Node.js application directory.

  • Write the configuration of WhaTap agent (whatap.conf).

  • Run the Node.js service again.

Creating a project

Create a project before installing the agent.

  1. Log in to the WhaTap Monitoring Service.

  2. In the left side menu, click All Projects > + Project.

  3. On the Select product screen, select the product you want to install.

  4. Enter or select the following items:

    • Project name: Enter the project name.

    • Data server region: Select the data server region. A region is a group of data centers that provide cloud services. Your data will be stored in the selected region.

    • Time zone: Set the time zone to be used for alerts and report generation.

    • Notification language setting: Set the language for alert notifications. (Supports Korean and English)

    • Project groups: Group multiple projects for easier management. Select a group if applicable.

    • Project description: Add additional details or a description for your project.

  5. After completing all settings, click the Creating a project button.

Note

If you add a project while an organization is selected, you must set the Groups of organization field.

For more information about groups, see the related document.

Checking the access key

The access key is the unique ID to enable the WhaTap service.

In the installation guide section, select Getting the access key. After the access key has been issued automatically, proceed to the next step.

Note

After a project has been created, the Agent installation page appears automatically. If the Agent installation does not appear, select Management > Agent installation on the left of the screen.

Download agent

  1. Install the agent in the active Node.js application directory.

    $ npm install --save whatap
  2. Copy the whatap.conf file in the node_modules/whatap path and then paste it into the root path of the project (same location as in the package.json file).

  3. Go to the WhaTap Monitoring Service.

  4. Select the created project and then copy the following among the downloaded items from the agent in the Install guide section.

    Example
    license={access key}
    whatap.server.host={collection server IP}
  5. Paste it into the whatap.conf file.

The host (whatap.server.host) address is the server address in which the WhaTap proxy has been installed. You can use a forward slash (/) as the delimiter to enter all addresses of the servers where the proxy server is running among the WhaTap servers.

For the agent configuration file, see the following.

Tip

Server-side rendering (SSR) frameworks such as Next.js and Nuxt.js require the Custom Server settings for application monitoring. It requires an approach different from typical Node.js frameworks (e.g. Express.js, Nest.js). For more information, see the following:

Using

Set the WHATAP_HOME environment variable

Set the application directory path to the WHATAP_HOME environment variable. If you do not specify it, the current working directory (process.cwd()) is used by default.

export WHATAP_HOME={app_root_path}

Create a whatap.conf file in the WHATAP_HOME path and set the following values.

# whatap.conf
app_name=MyNodeApp # Application name, default: NODE
app_process_name=node # Process name (for example, node)

Configure the agent

Add the following code at the top of the entry point (main module) file of the application. For example, in the Express.js application, app.js and server.js are the entry points (main module). When using a framework like Nest.js, main.ts is the entry point.

CommonJS
var whatap = require('whatap').NodeAgent;

Setting agent options by environment

To apply settings tailored to each environment of the application, you can modify the settings in the entry point file of the application instead of the whatap.conf file. Noting the code below, apply the settings tailored to your environment.

process.env.WHATAP_CONF = 'whatap_dev.conf'; // Setting for development environment
var WhatapAgent = require('whatap').NodeAgent;
  • In case different projects are run for each environment

    Even for the same application, settings are required for each environment, such as development (dev), test (test), and operation (prod). As in the example above, you can use the WHATAP_CONF environment variables to apply settings that are appropriate for the development environment. This allows you to easily manage different settings for each environment.

  • In case you must configure different agent options depending on the environment

    For development environment, you can increase the logging level. In production environment, you can configure different options for performance optimization. In this case, modify the agent options in the application's entry point file to suit the environment.

  • In case of running applications in cluster mode for PM2

    When you run multiple application instances in cluster mode, the system consolidates them and displays them under a single app_name(WHATAP_HOME).

Using the agent group unit function

Agent group unit function includes group topology and integrated topology. Replace {group identifier} with agent group name in the following code.

process.env.WHATAP_OKIND = '{group identifier}';
var WhatapAgent = require('whatap').NodeAgent;

// Or write the following in whatap.conf
whatap.okind = {group identifier}

Options that can be configured as environment variables

Because you cannot use the whatap.conf file, set the WhaTap agent options as environment variables in the source file.

app.js
process.env.profile_http_header_enabled=false;
process.env.profile_http_parameter_enabled=false;

process.env.profile_basetime=500;

process.env.auto_oname_enabled=false;
process.env.auto_oname_prefix='nodejs';

process.env.mtrace_rate=0;
process.env.mtrace_spec='v1';
process.env.stat_mtrace_enabled=false;
process.env.stat_domain_enabled=false;
Note

For more information about the options that can be set in Node.js, see the following.

Next steps

  • Checking the installation

    If you have applied all for project creation and agent installation, check the checklist in [the following] (install-check).

  • Agent setting

    It provides various features for monitoring by applying some options to the agent configuration file (whatap.conf). It includes basic configuration, configuration for server connection and data transfer, how to manage the configuration files for multiple application servers, and transaction tracing, and more. For more information, see the following.

  • Starting the monitoring

    After all settings are made, restart the application server. The agent starts collecting data. First, check whether the monitoring data has been collected in Application Dashboard. For more information about Application Dashboard, see the following.