-
Notifications
You must be signed in to change notification settings - Fork 14
Add RUM_INJECTION scenario to test Real User Monitoring SDK injection #5813
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
Merged
robertomonteromiguel
merged 14 commits into
main
from
robertomonteromiguel/rum_injection
Dec 12, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e3efe18
Add RUM_INJECTION scenario to test Real User Monitoring SDK injection
robertomonteromiguel ffde172
document the new endpoint
robertomonteromiguel 406fb39
Update docs/weblog/README.md
robertomonteromiguel 5ea79cf
rum activation on the default scenario
robertomonteromiguel 90a2c70
RUM auto-injection feature (#5826)
hennadii-datadog a5c608a
Merge branch 'main' into robertomonteromiguel/rum_injection
hennadii-datadog 16116c4
Merge branch 'main' into robertomonteromiguel/rum_injection
hennadii-datadog 73d969c
Merge branch 'main' into robertomonteromiguel/rum_injection
robertomonteromiguel 1f2172c
Set content type for the endpoint /headers
robertomonteromiguel 8af043c
merge main
robertomonteromiguel 765df4b
java manifest
robertomonteromiguel 81f2e18
Merge branch 'main' into robertomonteromiguel/rum_injection
robertomonteromiguel 0df7599
merge main
robertomonteromiguel 9fe4ad4
Merge branch 'main' into robertomonteromiguel/rum_injection
robertomonteromiguel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Unless explicitly stated otherwise all files in this repository are licensed under the the Apache License Version 2.0. | ||
| # This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| # Copyright 2021 Datadog, Inc. | ||
|
|
||
| """Tests for RUM (Real User Monitoring) support scenario""" | ||
|
|
||
| from html.parser import HTMLParser | ||
|
|
||
| from utils import weblog, features | ||
|
|
||
|
|
||
| @features.rum_injection | ||
| class Test_RUM_Injection: | ||
| """Basic tests to verify RUM injection is working""" | ||
|
|
||
| def setup_rum_enabled(self): | ||
| """Make a request to generate HTML with RUM configuration enabled""" | ||
| self.response = weblog.get("/html") | ||
|
|
||
| def test_rum_enabled(self): | ||
| """Verify that RUM scripts are injected into the HTML response""" | ||
| assert self.response.status_code == 200, f"Expected 200, got {self.response.status_code}" | ||
|
|
||
| html = self.response.text | ||
|
|
||
| # Validate HTML is well-formed | ||
| assert _is_valid_html(html), "HTML is malformed" | ||
|
|
||
| # Validate RUM SDK script is present (ignoring version number) | ||
| assert "https://www.datadoghq-browser-agent.com/datadog-rum-v" in html, "RUM SDK script not found" | ||
|
|
||
| # Validate RUM initialization call is present | ||
| assert "window.DD_RUM.init" in html, "RUM init call not found" | ||
|
|
||
|
|
||
| def _is_valid_html(html: str) -> bool: | ||
| """Check if HTML is well-formed""" | ||
| try: | ||
| HTMLParser().feed(html) | ||
| return True | ||
| except Exception: | ||
| return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
.../java/spring-boot/src/main/java/com/datadoghq/system_tests/springboot/HtmlController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.datadoghq.system_tests.springboot; | ||
|
|
||
| import org.springframework.stereotype.Controller; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.ResponseBody; | ||
|
|
||
| @Controller | ||
| public class HtmlController { | ||
|
|
||
| @GetMapping("/html") | ||
| public String html() { | ||
| return "hello"; | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
utils/build/docker/java/spring-boot/src/main/resources/templates/hello.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Hello from view</title> | ||
| </head> | ||
| <body> | ||
| <h1>Hello from view</h1> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.