Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions docs/weblog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ The following text may be written to the body of the response:
Hello headers!\n
```

### GET /html

This endpoint returns an HTML page instead of a JSON response. It is used to test features that require HTML content, such as RUM (Real User Monitoring) auto-injection.

**Important:** This is a server-rendered HTML endpoint, not a REST/JSON endpoint. The tracer may inject additional scripts (like the RUM SDK) into the HTML response when RUM injection is enabled.

The response content type must be `text/html`.

The HTML content **must** be :

```html
<!DOCTYPE html>
<html>
<head>
<title>Hello</title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
```

**Note:** When RUM injection is enabled via environment variables (`DD_RUM_ENABLED=true`), the tracer will automatically inject the RUM SDK script into the HTML response.

### GET /identify

This endpoint must set the following tags on the local root span:
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_httpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ manifest:
tests/test_profiling.py: missing_feature (missing profiling module in weblog)
tests/test_protobuf.py: missing_feature
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v1.0.0 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v1.0.0 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v1.0.0 # real version unknown
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ manifest:
tests/test_miscs.py: irrelevant
tests/test_protobuf.py: missing_feature
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v1.0.0 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v1.0.0 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v1.0.0 # real version unknown
Expand Down
1 change: 1 addition & 0 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ manifest:
uds: missing_feature (to be confirmed)
tests/test_protobuf.py::Test_Protobuf: v3.15.0
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v3.11.1 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v3.11.1 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v3.11.1 # real version unknown
Expand Down
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ manifest:
tests/test_library_conf.py::Test_HeaderTags_Wildcard_Response_Headers: missing_feature
tests/test_protobuf.py: missing_feature
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v1.72.1 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v1.72.1 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v1.72.1 # real version unknown
Expand Down
4 changes: 4 additions & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2623,6 +2623,10 @@ manifest:
"*": missing_feature
spring-boot: v1.47.0
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py:
- weblog_declaration:
"*": irrelevant (RUM injection only supported for spring-boot)
spring-boot: v1.49.0
tests/test_sampling_rates.py::Test_SampleRateFunction:
- weblog_declaration:
"*": v1.49.0
Expand Down
1 change: 1 addition & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,7 @@ manifest:
- weblog_declaration:
"*": *ref_5_81_0
nextjs: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: *ref_5_54_0
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: *ref_5_17_0
tests/test_sampling_rates.py::Test_SamplingDecisions: *ref_5_54_0
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ manifest:
tests/test_profiling.py::Test_Profile: missing_feature (profiling seems not to be activated)
tests/test_protobuf.py: missing_feature
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v1.13.0+4663b2fa7c20c6920f347d059b57dc2a419cb7f7
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v1.7.2 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v1.13.0+4663b2fa7c20c6920f347d059b57dc2a419cb7f7
Expand Down
1 change: 1 addition & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,7 @@ manifest:
tests/test_protobuf.py: missing_feature
tests/test_resource_renaming.py::Test_Resource_Renaming_HTTP_Endpoint_Tag: v3.17.0
tests/test_resource_renaming.py::Test_Resource_Renaming_Stats_Aggregation_Keys: v3.17.0
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v3.6.0+dev
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v2.8.0
tests/test_sampling_rates.py::Test_SamplingDecisions: v3.6.0+dev
Expand Down
1 change: 1 addition & 0 deletions manifests/python_lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,5 @@ manifest:
"*": v8.113.0
alb-multi: v8.114.0.dev
tests/test_resource_renaming.py: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_v1_payloads.py: missing_feature
1 change: 1 addition & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ manifest:
sinatra41: irrelevant
uds-sinatra: irrelevant
tests/test_resource_renaming.py::Test_Resource_Renaming_Stats_Aggregation_Keys: missing_feature
tests/test_rum_injection.py: irrelevant (RUM injection only supported for Java)
tests/test_sampling_rates.py::Test_SampleRateFunction: v2.15.0 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisionAdded: v2.12.1 # real version unknown
tests/test_sampling_rates.py::Test_SamplingDecisions: v2.15.0 # real version unknown
Expand Down
42 changes: 42 additions & 0 deletions tests/test_rum_injection.py
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
8 changes: 8 additions & 0 deletions tests/test_semantic_conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"servlet.forward": "java-web-servlet-dispatcher",
"servlet.response": "java-web-servlet-response",
"grpc.server": "grpc-server",
"response.render": "spring-webmvc",
},
"spring-boot-jetty": {
"servlet.request": "jetty-server",
Expand All @@ -57,19 +58,22 @@
"servlet.forward": "java-web-servlet-dispatcher",
"servlet.response": "java-web-servlet-response",
"servlet.error": "java-web-servlet-dispatcher",
"response.render": "spring-webmvc",
},
"spring-boot-3-native": {
"servlet.request": "tomcat-server",
"spring.handler": "spring-web-controller",
"hsqldb.query": "java-jdbc-statement",
"servlet.response": "java-web-servlet-response",
"response.render": "spring-webmvc",
},
"spring-boot-openliberty": {
"servlet.request": ["liberty-server", "java-web-servlet"],
"hsqldb.query": "java-jdbc-statement",
"spring.handler": "spring-web-controller",
"servlet.forward": "java-web-servlet-dispatcher",
"servlet.response": "java-web-servlet-response",
"response.render": "spring-webmvc",
},
"spring-boot-undertow": {
"servlet.request": "undertow-http-server",
Expand All @@ -78,6 +82,7 @@
"undertow-http.request": "undertow-http-server",
"servlet.response": "java-web-servlet-response",
"servlet.forward": "java-web-servlet-dispatcher",
"response.render": "spring-webmvc",
},
"spring-boot-wildfly": {
"servlet.request": "undertow-http-server",
Expand All @@ -86,13 +91,15 @@
"servlet.forward": "java-web-servlet-dispatcher",
"spring.handler": "spring-web-controller",
"servlet.response": "java-web-servlet-response",
"response.render": "spring-webmvc",
},
"spring-boot-payara": {
"servlet.request": "java-web-servlet",
"hsqldb.query": "java-jdbc-statement",
"servlet.forward": "java-web-servlet-dispatcher",
"spring.handler": "spring-web-controller",
"servlet.response": "java-web-servlet-response",
"response.render": "spring-webmvc",
},
"resteasy-netty3": {"netty.request": ["netty", "jax-rs"], "jax-rs.request": "jax-rs-controller"},
"akka-http": "akka-http-server",
Expand All @@ -118,6 +125,7 @@
"hsqldb.query": "java-jdbc-statement",
"spring.handler": "spring-web-controller",
"servlet.forward": "java-web-servlet-dispatcher",
"response.render": "spring-webmvc",
},
"vertx3": {"netty.request": "netty", "vertx.route-handler": "vertx"},
"vertx4": {"netty.request": "netty", "vertx.route-handler": "vertx"},
Expand Down
4 changes: 4 additions & 0 deletions utils/_context/_scenarios/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def __init__(self, name: str):
# but we need proper investigation to see how to properly tests everything
# waiting for this audit, we disable API security
"DD_API_SECURITY_ENABLED": "false",
"DD_RUM_ENABLED": "true",
"DD_RUM_APPLICATION_ID": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"DD_RUM_CLIENT_TOKEN": "pubaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"DD_RUM_REMOTE_CONFIGURATION_ID": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
},
agent_env={"SOME_SECRET_ENV": "leaked-env-var"},
include_postgres_db=True,
Expand Down
8 changes: 8 additions & 0 deletions utils/_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,14 @@ def llm_observability_prompts(test_object):
"""
return _mark_test_object(test_object, feature_id=517, owner=_Owner.ml_observability)

@staticmethod
def rum_injection(test_object):
"""RUM Injection

https://feature-parity.us1.prod.dog/#/?feature=525
"""
return _mark_test_object(test_object, feature_id=525, owner=_Owner.sdk_capabilities)

@staticmethod
def apm_openai_completions(test_object):
"""APM supports OpenAI completions interactions
Expand Down
4 changes: 4 additions & 0 deletions utils/build/docker/java/spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Map<String, Object> healtchcheck() {
return response;
}

@GetMapping("/headers")
@GetMapping(value = "/headers", produces = "text/plain")
String headers(HttpServletResponse response) {
response.setHeader("content-language", "en-US");
return "012345678901234567890123456789012345678901";
Expand Down
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";
}
}
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>
Loading