diff --git a/manifests/golang.yml b/manifests/golang.yml index 87558c5694..c7b63afbd9 100644 --- a/manifests/golang.yml +++ b/manifests/golang.yml @@ -585,6 +585,7 @@ tests/: Test_LibraryHeaders: v1.60.0.dev0 test_distributed.py: Test_DistributedHttp: missing_feature + Test_Synthetics_APM_Datadog: bug (APMAPI-901) # the incoming headers are considered invalid test_identify.py: Test_Basic: v1.37.0 Test_Propagate: v1.48.0-rc.1 diff --git a/manifests/nodejs.yml b/manifests/nodejs.yml index 6bdbe5b40e..20cf477e4e 100644 --- a/manifests/nodejs.yml +++ b/manifests/nodejs.yml @@ -755,6 +755,9 @@ tests/: Test_Config_UnifiedServiceTagging_Default: *ref_5_25_0 test_distributed.py: Test_DistributedHttp: missing_feature + Test_Synthetics_APM_Datadog: + '*': *ref_5_25_0 + nextjs: bug (APMAPI-939) # the nextjs weblog application changes the sampling priority from 1.0 to 2.0 test_identify.py: Test_Basic: v2.4.0 Test_Propagate: *ref_3_2_0 diff --git a/tests/test_distributed.py b/tests/test_distributed.py index ca8af6b56f..349e0fff9a 100644 --- a/tests/test_distributed.py +++ b/tests/test_distributed.py @@ -3,6 +3,7 @@ # Copyright 2022 Datadog, Inc. import json +from utils.parametric.spec.trace import SAMPLING_PRIORITY_KEY, ORIGIN from utils import weblog, interfaces, scenarios, features @@ -25,3 +26,51 @@ def test_main(self): assert "x-datadog-sampling-priority" not in data["request_headers"] assert "x-datadog-tags" not in data["request_headers"] assert "x-datadog-trace-id" not in data["request_headers"] + + +@scenarios.default +@features.datadog_headers_propagation +class Test_Synthetics_APM_Datadog: + def setup_synthetics(self): + self.r = weblog.get( + "/", + headers={ + "x-datadog-trace-id": "1234567890", + "x-datadog-parent-id": "0", + "x-datadog-sampling-priority": "1", + "x-datadog-origin": "synthetics", + }, + ) + + def test_synthetics(self): + interfaces.library.assert_trace_exists(self.r) + spans = interfaces.agent.get_spans_list(self.r) + assert len(spans) == 1, "Agent received the incorrect amount of spans" + + span = spans[0] + assert span.get("traceID") == "1234567890" + assert "parentID" not in span or span.get("parentID") == 0 or span.get("parentID") is None + assert span.get("meta")[ORIGIN] == "synthetics" + assert span.get("metrics")[SAMPLING_PRIORITY_KEY] == 1 + + def setup_synthetics_browser(self): + self.r = weblog.get( + "/", + headers={ + "x-datadog-trace-id": "1234567891", + "x-datadog-parent-id": "0", + "x-datadog-sampling-priority": "1", + "x-datadog-origin": "synthetics-browser", + }, + ) + + def test_synthetics_browser(self): + interfaces.library.assert_trace_exists(self.r) + spans = interfaces.agent.get_spans_list(self.r) + assert len(spans) == 1, "Agent received the incorrect amount of spans" + + span = spans[0] + assert span.get("traceID") == "1234567891" + assert "parentID" not in span or span.get("parentID") == 0 or span.get("parentID") is None + assert span.get("meta")[ORIGIN] == "synthetics-browser" + assert span.get("metrics")[SAMPLING_PRIORITY_KEY] == 1