Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt RUM server onboarding to include httpd #27435

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 90 additions & 5 deletions content/en/real_user_monitoring/browser/setup/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ After your applications have been instrumented, you can configure your RUM appli
The available functionality has the following important limitations:

- If proxying compressed traffic, the Auto-Instrumentation method is not able to inject the JS scriptlet into the HTML traffic.
- This instrumentation method does not support any [advanced RUM configurations][3]. However, `allowedTracingUrls` and `excludedActivityUrls` are supported for NGINX web servers.
- If NGINX or IIS is acting as a proxy and the upstream server has end-to-end encryption (like TLS) enabled, the module cannot inject RUM. Ensure the web server is set up for TLS origination for successful instrumentation.
- This instrumentation method does not support any [advanced RUM configurations][3]. However, `allowedTracingUrls` and `excludedActivityUrls` are supported for NGINX, Windows IIS, and Apache httpd web servers.
- If the web server is acting as a proxy and the upstream server has end-to-end encryption (like TLS) or content compression (like gzip, zstd, or Brotli) enabled, the module may not inject RUM. Ensure the following for successful instrumentation:
- Content compression is disabled on the upstream server.
- The web server is configured to compress the content.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rtrieu what was your intention behind this line? As of right now it is a bit confusing for me, as it sounds like we're recommending to enable content compression, which shouldn't have an impact on our solution either way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pablomartinezbernardo my intention was to consolidate this section with the information that was previously under Troubleshooting. We can change it back if this is confusing.

- The web server is set up for TLS origination.
- (Windows IIS only) Configuration for Auto-Instrumentation is only available per Windows IIS site.

## Prerequisites
Expand Down Expand Up @@ -115,6 +118,75 @@ To automatically instrument your RUM application:

{{% /collapse-content %}}

{{% /tab %}}
{{% tab "Apache httpd" %}}

The Auto-Instrumentation method leverages the [Apache httpd Modules capability][1] to implement a response body filter. The filter injects the RUM SDK into the response body for responses
identified as HTML. For more granular control over how configuration files or permissions are handled, you can also install Apache httpd Server manually.

[1]: https://httpd.apache.org/modules/


{{% collapse-content title="Automatic installation (recommended)" level="h5" %}}

To automatically instrument your RUM application:

1. In Datadog, navigate to the [**Digital Experience > Add an Application Page**][1] and select the JavaScript (JS) application type.
2. Select **Auto-Instrumentation** and **httpd**.
3. Set your Session and Session Replay sample rates. See [guidance on configuring sampling][2].
4. Copy and run the installer command to load the Datadog httpd Module with the RUM SDK Injector onto httpd.
5. After the installer successfully installs the SDK Injector, restart httpd 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 httpd is configured with at least the `info` log level.

[1]: https://app.datadoghq.com/rum/list
[2]: /real_user_monitoring/guide/sampling-browser-plans/

{{% /collapse-content %}}

{{% collapse-content title="Manual configuration" level="h5" %}}

### Download the module file

1. Download the [zipped module][1].
2. Extract the zip to obtain the `mod_datadog.so` file. Move it to a location that httpd has access to (referenced as `<RUM_MODULE_PATH>` in the steps below).

[1]: https://rum-auto-instrumentation.s3.amazonaws.com/httpd/latest/mod_datadog-amd64.zip

### Update httpd configuration
1. Locate the configuration file. You can use `apachectl -V` to see the configuration path. Add the following line to load the module:

```javascript
LoadModule datadog_module <RUM_MODULE_PATH>
```

2. Then in the appropriate **root or location** section, add the following:

```javascript
# APM Tracing is enabled by default. The following line disables APM Tracing
DatadogTracing Off
DatadogRum On
<DatadogRumSettings>
DatadogRumOption "applicationId" "<DATADOG_APPLICATION_ID>"
DatadogRumOption "clientToken" "<DATADOG_CLIENT_TOKEN>"
DatadogRumOption "site" "<DATADOG_SITE>"
DatadogRumOption "service" "my-web-application"
DatadogRumOption "env" "production"
DatadogRumOption "version" "1.0.0"
DatadogRumOption "sessionSampleRate" "100"
DatadogRumOption "sessionReplaySampleRate" "100"
DatadogRumOption "trackResources" "true"
DatadogRumOption "trackLongTasks" "true"
DatadogRumOption "trackUserInteractions" "true"
</DatadogRumSettings>
```

### Restart your server

1. Restart the httpd 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 httpd error logs for relevant messages. The module logs important steps during the injection process. Ensure that httpd is configured with at least the `info` log level.

{{% /collapse-content %}}

{{% /tab %}}
{{% tab "Windows IIS" %}}

Expand Down Expand Up @@ -162,7 +234,19 @@ To update your RUM Application:

1. Go to your RUM application from the [Application Management][1] list.
2. On the Instrument your application page, adjust the slider or enter a specific percentage in the input box for Session Sampling or Session Replay Sampling.
3. Copy and run the installer command in your `NGINX.conf` file.
3. Copy and paste the configuration snippet to your `NGINX.conf` file.

[1]: https://app.datadoghq.com/rum/list

{{% /tab %}}

{{% tab "httpd" %}}

To update your RUM Application:

1. Go to your RUM application from the [Application Management][1] list.
2. On the Instrument your application 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 `/opt/datadog-httpd/datadog.conf` file.

[1]: https://app.datadoghq.com/rum/list

Expand Down Expand Up @@ -195,7 +279,7 @@ Since the module is in Preview, it's possible NGINX may stop serving requests, p
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.
- **Content compression by upstream server**: If NGINX is acting as a proxy and the upstream server has content compression (like gzip, zstd, or Brotli) enabled, the module may not inject RUM. Ensure that content compression is disabled on the upstream server and configure NGINX to compress the content.
- **Upstream server has end-to-end encryption or content compression**: See [Limitations][41].

## Reference

Expand Down Expand Up @@ -265,4 +349,5 @@ If you notice that RUM is not being injected into HTML pages, consider the follo
[37]: https://ddagent-windows-unstable.s3.amazonaws.com/inject-browser-sdk/nginx/latest/ngx_http_datadog_module-amd64-1.26.2.so.tgz
[38]: https://ddagent-windows-unstable.s3.amazonaws.com/inject-browser-sdk/nginx/latest/ngx_http_datadog_module-arm64-1.26.2.so.tgz
[39]: https://ddagent-windows-unstable.s3.amazonaws.com/inject-browser-sdk/nginx/latest/ngx_http_datadog_module-amd64-1.27.0.so.tgz
[40]: https://ddagent-windows-unstable.s3.amazonaws.com/inject-browser-sdk/nginx/latest/ngx_http_datadog_module-arm64-1.27.0.so.tgz
[40]: https://ddagent-windows-unstable.s3.amazonaws.com/inject-browser-sdk/nginx/latest/ngx_http_datadog_module-arm64-1.27.0.so.tgz
[41]: /real_user_monitoring/browser/setup/server/#limitations
Loading