Skip to content

Conversation

@robertomonteromiguel
Copy link
Collaborator

@robertomonteromiguel robertomonteromiguel commented Dec 3, 2025

Motivation

RUM (Real User Monitoring) auto-injection is a tracer feature that automatically injects the RUM SDK script into HTML responses served by instrumented applications. This allows frontend monitoring to be enabled without requiring manual code changes in the application.
Until now, system-tests had no way to validate this functionality because:

  • Our weblogs were designed exclusively as REST API controllers returning JSON responses
  • RUM injection only applies to HTML content-type responses — it has no effect on JSON/API endpoints
  • We needed an endpoint that returns actual HTML markup for the tracer to inject the RUM SDK into

https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/setup/server/java/

Related with this draft PR: https://github.com/DataDog/system-tests/pull/5809/files

Changes

New /html endpoint:

Introduces an HTML controller to the Java Spring Boot weblog. This is the first endpoint in system-tests that serves rendered HTML content (via Thymeleaf templates) rather than JSON responses. This pattern can be extended to other weblogs as needed.

New RUM_INJECTION scenario:

A dedicated end-to-end scenario that enables RUM injection via environment variables:

  • DD_RUM_ENABLED=true
  • DD_RUM_APPLICATION_ID
  • DD_RUM_CLIENT_TOKEN
  • DD_RUM_REMOTE_CONFIGURATION_ID

Test validations:
✅ HTML response is well-formed
✅ RUM SDK script (datadoghq-browser-agent.com/datadog-rum-v*) is injected
✅ RUM initialization call (window.DD_RUM.init) is present

The new scenario is not added to the CI yet.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • If PR title starts with [<language>], double-check that only <language> is impacted by the change
  • No system-tests internal is modified. Otherwise, I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added (or removed)?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

CODEOWNERS have been resolved as:

tests/test_rum_injection.py                                             @DataDog/system-tests-core
utils/build/docker/java/spring-boot/src/main/java/com/datadoghq/system_tests/springboot/HtmlController.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/spring-boot/src/main/resources/templates/hello.html  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
docs/weblog/README.md                                                   @DataDog/system-tests-core
manifests/cpp_httpd.yml                                                 @DataDog/system-tests-core
manifests/cpp_nginx.yml                                                 @DataDog/system-tests-core
manifests/dotnet.yml                                                    @DataDog/apm-dotnet @DataDog/asm-dotnet
manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
manifests/python_lambda.yml                                             @DataDog/system-tests-core
manifests/ruby.yml                                                      @DataDog/ruby-guild @DataDog/asm-ruby
tests/test_semantic_conventions.py                                      @DataDog/system-tests-core
utils/_context/_scenarios/default.py                                    @DataDog/system-tests-core
utils/_features.py                                                      @DataDog/system-tests-core
utils/build/docker/java/spring-boot/pom.xml                             @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core

Copy link
Contributor

@amarziali amarziali left a comment

Choose a reason for hiding this comment

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

It’s expected that the Java RUM injection will not send the Content-Type header when the injection is enabled and the MIME type is text/html. Because the Java RUM injector does not buffer the response, it cannot know in advance whether injection will occur. For this reason, it prevents the Content-Length header from being set, which forces the response to use chunked transfer encoding. This behavior is as designed. I believe a dedicated scenario should be created for this set of tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants