Skip to content

Commit 731f502

Browse files
rtrieujanine-c
authored andcommitted
[DOCS-11542] Java servlet-based web apps RUM (#30869)
* [DOCS-11542] Java servlet support RUM * add logo to partial * remove config * Apply suggestions from code review Co-authored-by: Janine Chan <[email protected]> * push changes * Update content/en/real_user_monitoring/browser/setup/server/java.md Co-authored-by: Janine Chan <[email protected]> * update link --------- Co-authored-by: Janine Chan <[email protected]>
1 parent d2bb7d5 commit 731f502

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Java Servlet
3+
beta: true
4+
code_lang: java
5+
type: multi-code-lang
6+
code_lang_weight: 7
7+
further_reading:
8+
- link: '/real_user_monitoring/browser/setup/server/'
9+
tag: 'Documentation'
10+
text: 'Browser Monitoring Auto-Instrumentation'
11+
---
12+
13+
{{< callout url="https://forms.gle/RdVvDsmmzW21s2vd7" header="Join the Preview!">}}
14+
RUM Auto-Instrumentation through Java servlet-based web servers is in Preview.
15+
{{< /callout >}}
16+
17+
## Overview
18+
19+
RUM Auto-Instrumentation automatically adds RUM monitoring to your web application server, so you can start collecting RUM data by editing a configuration file instead of having to modify your frontend code directly. However, if you want to track specific user actions (custom actions) or add custom event details (event attributes), you still need to add some code to your application.
20+
21+
## How it works
22+
23+
The Java SDK works by monitoring your servlet API (which handles web requests and responses), automatically checking each HTTP response your server sends. When it detects an HTML response, it looks for the `<head>` section and automatically adds the RUM JavaScript code there. The rest of your HTML content remains unchanged. This approach adds minimal overhead, so it works well even with streaming responses (where content is sent in real-time).
24+
25+
## Prerequisites
26+
27+
### Server requirements
28+
- Java web application server with Servlet API 3.0 or higher support:
29+
- Jetty 7+
30+
- Tomcat 7+
31+
- GlassFish 3+ / Payara 4.1+
32+
- JBoss AS 6+ / Wildfly 8+
33+
- Undertow 1+
34+
- WebLogic 12+
35+
- WebSphere AS 8+ / Open Liberty 17+
36+
37+
### SDK requirements
38+
- Java SDK installed using either:
39+
- [Automatic instrumentation][1] (SSI)
40+
- [Manual Java SDK installation][2]
41+
42+
### Datadog configuration
43+
- RUM application [created in Datadog][3]
44+
- Configuration values ready:
45+
- `clientToken`
46+
- `applicationId`
47+
- `remoteConfigurationId`
48+
49+
## Configuration
50+
51+
To get access to configuration steps for this feature, [join the preview program][4].
52+
53+
## Troubleshooting
54+
55+
### RUM JavaScript tag is not injected
56+
57+
If you don't see the RUM JavaScript tag injected, try the following steps:
58+
59+
1. **Check server logs** for any error messages related to RUM Auto-Instrumentation
60+
2. **Verify configuration** - ensure all required environment variables defined at the configuration step are set:
61+
- `DD_RUM_ENABLED=true`
62+
- `DD_RUM_APPLICATION_ID=<your-application-id>`
63+
- `DD_RUM_CLIENT_TOKEN=<your-client-token>`
64+
- `DD_RUM_REMOTE_CONFIGURATION_ID=<your-remote-config-id>`
65+
3. **Enable debug logging** by setting `dd.trace.debug=true` (system property) or `DD_TRACE_DEBUG=true` (environment variable)
66+
4. **Check HTML response** - ensure your server is returning HTML with a `<head>` section
67+
5. **Clear browser cache** - cached pages do not show the injected JavaScript
68+
69+
In addition, when debug logging is enabled, you should see a message like this at startup:
70+
71+
```shell
72+
DEBUG datadog.trace.api.Config - New instance: Config{..., rumEnabled=true, rumInjectorConfig={"applicationId":"appid","clientToken":"token","site":"datadoghq.com","remoteConfigurationId":"remoteconfigid"}, ...}
73+
```
74+
75+
This confirms that RUM Auto-Instrumentation is properly configured.
76+
77+
## Further reading
78+
79+
{{< partial name="whats-next/whats-next.html" >}}
80+
81+
[1]: /tracing/trace_collection/automatic_instrumentation/?tab=singlestepinstrumentation
82+
[2]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/java/
83+
[3]: https://app.datadoghq.com/rum/list
84+
[4]: https://forms.gle/RdVvDsmmzW21s2vd7

layouts/partials/rum/rum-browser-setup.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
</div>
3232
</a>
3333
</div>
34+
<div class="col">
35+
<a class="card h-100" href="/real_user_monitoring/browser/setup/server/java">
36+
<div class="card-body text-center py-2 px-1">
37+
{{ partial "img.html" (dict "root" . "src" "integrations_logos/docs-custom-java-servlet-web-apps.png" "class" "img-fluid" "alt" "java_servlet" "width" "200") }}
38+
</div>
39+
</a>
40+
</div>
3441
</div>
3542
</div>
3643
</div>
8.19 KB
Loading

0 commit comments

Comments
 (0)