このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください
To try the preview for RUM Auto-Instrumentation, follow the instructions on this page.

Overview

RUM Auto-Instrumentation works by injecting the RUM Browser SDK into the HTML responses being served through a web server or proxy.

To understand important limitations and compatibility requirements, see Limitations.

Prerequisites

The Datadog Agent is installed and configured.

Set up your RUM application

The auto-instrumentation method leverages the NGINX Dynamic Modules capability to implement a response body filter. The filter injects the RUM Browser SDK into the response body for responses identified as HTML.

For more granular control over the instrumentation of the RUM application, you can also manually install and configure the module.

To automatically instrument your RUM application:

  1. In Datadog, navigate to the Digital Experience > Add an Application Page and select the JavaScript (JS) application type.

  2. Select Auto-Instrumentation and NGINX.

  3. Set your Session and Session Replay sample rates. See guidance on configuring sampling.

  4. Copy and run the installer command to load the Datadog NGINX Module with the RUM SDK Injector onto NGINX.

  5. After the installer successfully installs the SDK Injector, restart NGINX to begin collecting RUM sessions.

  6. (Optional) To verify the module is successfully injecting the RUM Browser SDK into HTML pages, check the NGINX error logs for relevant messages. The module logs important steps during the injection process. Ensure that NGINX is configured with at least the INFO log level with the following:

    error_log <file> info;
    

To manually load the module onto your web server instead of running the installation script, follow the instructions below.

To manually instrument your RUM application:

Download the appropriate .tgz file

  1. Use the .tgz file corresponding to your version of NGINX. You can find all the relevant .tgz files listed by NGINX version under Reference.
  2. Extract the tarball to extract the ngx_http_datadog_module.so file. Move it to a location that NGINX has access to (referenced as <RUM_MODULE_PATH> in the steps below).

Update NGINX configuration

  1. The nginx.conf file is usually located in NGINX’s configuration directory. Add the following line to load the module:

    load_module <RUM_MODULE_PATH>;
    
  2. Then in the http/server/location section, add the following:

    # APM Tracing is enabled by default. The following line disables APM Tracing.
    datadog_disable;
    datadog_rum on;
    datadog_rum_config "v5" {
      "applicationId" "<DATADOG_APPLICATION_ID>";
      "clientToken" "<DATADOG_CLIENT_TOKEN>";
      "site" "<DATADOG_SITE>";
      "service" "my-web-application";
      "env" "production";
      "version" "1.0.0";
      "sessionSampleRate" "100";
      "sessionReplaySampleRate" "100";
      "trackResources" "true";
      "trackLongTasks" "true";
      "trackUserInteractions" "true";
    }
    

Restart your server

  1. Restart the NGINX server to begin collecting data for your Datadog RUM application. By default, the RUM SDK is injected to all HTML documents. You may need to clear your browser cache.

  2. (Optional) To verify the module is successfully injecting the RUM Browser SDK into HTML pages, check the NGINX error logs for relevant messages. The module logs important steps during the injection process. Ensure that NGINX is configured with at least the INFO log level with the following:

    error_log <file> info;
    

Updating your RUM application

You can adjust your Session Sampling and Session Replay Sampling rates from the Application Management page.

To update your RUM Application:

  1. Go to your RUM application from the Application Management list.
  2. On the SDK Configuration page, adjust the slider or enter a specific percentage in the input box for Session Sampling or Session Replay Sampling.
  3. Copy and paste the configuration snippet to your nginx.conf file.

Troubleshooting

NGINX stops responding

Since the module is in Preview, it’s possible NGINX may stop serving requests, particularly after installation. If you experience this issue, contact Datadog support with the following information to help us investigate and resolve the issue:

  • Your NGINX configuration file
  • Any relevant error logs

RUM is not injected

If you notice that RUM is not being injected into HTML pages, consider the following potential causes:

  • Content-Type mismatch: RUM is injected only into HTML pages. If the Content-Type header does not correctly indicate text/html, the injection is skipped.

Limitations

See other Limitations.

Uninstall

To manually remove RUM from your auto-instrumented web server:

  1. Locate the NGINX configuration file by running nginx -T. For example: /etc/nginx/nginx.conf.

  2. At the beginning of the file, remove the line: load_module /opt/datadog-nginx/ngx_http_datadog_module.so;.

  3. In the file, remove all existing datadog_* sections from within the http directive. The sections look similar to the following, depending on your system configuration:

    datadog_agent_url http://datadog-agent:8126;
    datadog_tracing off;
    datadog_rum on;
    datadog_rum_config {
      # ... specific RUM configuration
    }
    
  4. Delete the directory /opt/datadog-nginx/ and all of its contents.

  5. Restart or reload your NGINX web server.

Reference

NGINX modules

Further reading

お役に立つドキュメント、リンクや記事:

PREVIEWING: pmartinez/rum-server-uninstall