From 6ca9a8877127932aa40a1831995c392735c0e61f Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 14:16:34 +0100 Subject: [PATCH 01/18] remove useless appsec references in non appsec tests --- tests/integration/test_integration_snapshots.py | 4 ++-- tests/tracer/test_processors.py | 2 +- tests/tracer/test_tracer.py | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_integration_snapshots.py b/tests/integration/test_integration_snapshots.py index 8bb70cf70a6..8cfc778376c 100644 --- a/tests/integration/test_integration_snapshots.py +++ b/tests/integration/test_integration_snapshots.py @@ -45,8 +45,8 @@ def test_flush_spans_before_writer_recreate(): long_running_span = tracer.trace("long_running_operation") writer = tracer._span_aggregator.writer - # Enable appsec to trigger the recreation of the agent writer - tracer.configure(appsec_enabled=True) + # Enable compute stats to trigger the recreation of the agent writer + tracer.configure(compute_stats_enabled=True) assert tracer._span_aggregator.writer is not writer, "Writer should be recreated" # Finish the long running span after the writer has been recreated long_running_span.finish() diff --git a/tests/tracer/test_processors.py b/tests/tracer/test_processors.py index a737da92a47..01b8d33e14b 100644 --- a/tests/tracer/test_processors.py +++ b/tests/tracer/test_processors.py @@ -204,7 +204,7 @@ def test_aggregator_reset_with_args(writer_class): assert aggr.sampling_processor.apm_opt_out is False assert aggr.sampling_processor._compute_stats_enabled is False # Reset the aggregator with new args and new user processors and expect the new values to be set - aggr.reset(user_processors=[], compute_stats=True, apm_opt_out=True, appsec_enabled=True, reset_buffer=False) + aggr.reset(user_processors=[], compute_stats=True, apm_opt_out=True, reset_buffer=False) assert aggr.user_processors == [] assert dd_proc in aggr.dd_processors assert aggr.sampling_processor.apm_opt_out is True diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index bd5b7909f87..46580150ad8 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -52,7 +52,6 @@ class TracerTestCases(TracerTestCase): @pytest.fixture(autouse=True) def inject_fixtures(self, tracer, caplog): self._caplog = caplog - self._tracer_appsec = tracer def test_tracer_vars(self): span = self.trace("a", service="s", resource="r", span_type="t") From 55d30f9f8b172f776b5e2476c84fcec5bdafc63b Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 14:52:05 +0100 Subject: [PATCH 02/18] moving tests to appsec file --- ...st_flush_spans_before_writer_recreate.json | 1 + tests/tracer/test_processors.py | 8 +- tests/tracer/test_trace_utils.py | 123 ---------- tests/tracer/test_tracer.py | 26 --- tests/tracer/test_tracer_appsec.py | 210 ++++++++++++++++++ 5 files changed, 215 insertions(+), 153 deletions(-) create mode 100644 tests/tracer/test_tracer_appsec.py diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json index 338c7f4b2ec..2c2fa9baddd 100644 --- a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json +++ b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json @@ -6,6 +6,7 @@ "trace_id": 0, "span_id": 1, "parent_id": 0, + "type": "", "meta": { "_dd.p.dm": "-0", "_dd.p.tid": "6854a54200000000", diff --git a/tests/tracer/test_processors.py b/tests/tracer/test_processors.py index 01b8d33e14b..e6b96dc0f41 100644 --- a/tests/tracer/test_processors.py +++ b/tests/tracer/test_processors.py @@ -178,7 +178,7 @@ def test_aggregator_reset_apm_opt_out_preserves_sampling(): def test_aggregator_reset_with_args(writer_class): """ Validates that the span aggregator can reset trace buffers, sampling processor, - user processors/filters and trace api version (when ASM is enabled) + user processors/filters. """ dd_proc = DummyProcessor() @@ -204,12 +204,12 @@ def test_aggregator_reset_with_args(writer_class): assert aggr.sampling_processor.apm_opt_out is False assert aggr.sampling_processor._compute_stats_enabled is False # Reset the aggregator with new args and new user processors and expect the new values to be set - aggr.reset(user_processors=[], compute_stats=True, apm_opt_out=True, reset_buffer=False) + aggr.reset(user_processors=[], compute_stats=True, reset_buffer=False) assert aggr.user_processors == [] assert dd_proc in aggr.dd_processors - assert aggr.sampling_processor.apm_opt_out is True + assert aggr.sampling_processor.apm_opt_out is False assert aggr.sampling_processor._compute_stats_enabled is True - assert aggr.writer._api_version == "v0.4" + assert aggr.writer._api_version == "v0.5" assert span.trace_id in aggr._traces assert len(aggr._span_metrics["spans_created"]) == 1 diff --git a/tests/tracer/test_trace_utils.py b/tests/tracer/test_trace_utils.py index 65b79767706..f0636662358 100644 --- a/tests/tracer/test_trace_utils.py +++ b/tests/tracer/test_trace_utils.py @@ -17,9 +17,7 @@ from ddtrace._trace.pin import Pin from ddtrace.contrib.internal import trace_utils from ddtrace.contrib.internal.trace_utils import _get_request_header_client_ip -from ddtrace.ext import SpanTypes from ddtrace.ext import http -from ddtrace.ext import net from ddtrace.internal.compat import ensure_text from ddtrace.propagation.http import HTTP_HEADER_PARENT_ID from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID @@ -28,7 +26,6 @@ from ddtrace.settings.integration import IntegrationConfig from ddtrace.trace import Context from ddtrace.trace import Span -from tests.appsec.utils import asm_context from tests.utils import override_global_config @@ -389,126 +386,6 @@ def test_set_http_meta_with_http_header_tags_config(): assert response_span.get_tag("third-header") == "value3" -@pytest.mark.parametrize("appsec_enabled", [False, True]) -@pytest.mark.parametrize("span_type", [SpanTypes.WEB, SpanTypes.HTTP, None]) -@pytest.mark.parametrize( - "method,url,status_code,status_msg,query,request_headers,response_headers,uri,path_params,cookies,target_host", - [ - ("GET", "http://localhost/", 0, None, None, None, None, None, None, None, "localhost"), - ("GET", "http://localhost/", 200, "OK", None, None, None, None, None, None, "localhost"), - (None, None, None, None, None, None, None, None, None, None, None), - ( - "GET", - "http://localhost/", - 200, - "OK", - None, - {"my-header": "value1"}, - {"resp-header": "val"}, - "http://localhost/", - None, - None, - "localhost", - ), - ( - "GET", - "http://localhost/", - 200, - "OK", - "q=test+query&q2=val", - {"my-header": "value1"}, - {"resp-header": "val"}, - "http://localhost/search?q=test+query&q2=val", - {"id": "val", "name": "vlad"}, - None, - "localhost", - ), - ("GET", "http://user:pass@localhost/", 0, None, None, None, None, None, None, None, None), - ("GET", "http://user@localhost/", 0, None, None, None, None, None, None, None, None), - ("GET", "http://user:pass@localhost/api?q=test", 0, None, None, None, None, None, None, None, None), - ("GET", "http://localhost/api@test", 0, None, None, None, None, None, None, None, None), - ("GET", "http://localhost/?api@test", 0, None, None, None, None, None, None, None, None), - ], -) -def test_set_http_meta( - span, - int_config, - method, - url, - target_host, - status_code, - status_msg, - query, - request_headers, - response_headers, - uri, - path_params, - cookies, - appsec_enabled, - span_type, -): - int_config.myint.http.trace_headers(["my-header"]) - int_config.myint.http.trace_query_string = True - span.span_type = span_type - with asm_context(config={"_asm_enabled": appsec_enabled}): - trace_utils.set_http_meta( - span, - int_config.myint, - method=method, - url=url, - target_host=target_host, - status_code=status_code, - status_msg=status_msg, - query=query, - raw_uri=uri, - request_headers=request_headers, - response_headers=response_headers, - request_cookies=cookies, - request_path_params=path_params, - ) - if method is not None: - assert span.get_tag(http.METHOD) == method - else: - assert http.METHOD not in span.get_tags() - - if target_host is not None: - assert span.get_tag(net.TARGET_HOST) == target_host - else: - assert net.TARGET_HOST not in span.get_tags() - - if url is not None: - if url.startswith("http://user"): - # Remove any userinfo that may be in the original url - expected_url = url[: url.index(":")] + "://" + url[url.index("@") + 1 :] - else: - expected_url = url - - if query and int_config.myint.http.trace_query_string: - assert span.get_tag(http.URL) == str(expected_url + "?" + query) - else: - assert span.get_tag(http.URL) == str(expected_url) - else: - assert http.URL not in span.get_tags() - - if status_code is not None: - assert span.get_tag(http.STATUS_CODE) == str(status_code) - if 500 <= int(status_code) < 600: - assert span.error == 1 - else: - assert span.error == 0 - else: - assert http.STATUS_CODE not in span.get_tags() - - if status_msg is not None: - assert span.get_tag(http.STATUS_MSG) == str(status_msg) - - if query is not None and int_config.myint.http.trace_query_string: - assert span.get_tag(http.QUERY_STRING) == query - - if request_headers is not None: - for header, value in request_headers.items(): - tag = "http.request.headers." + header - assert span.get_tag(tag) == value @mock.patch("ddtrace.settings._config.log") diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index 46580150ad8..f579d18b40a 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -1902,32 +1902,6 @@ def test_finish_span_with_ancestors(tracer): assert span3.finished -@pytest.mark.parametrize("sca_enabled", ["true", "false"]) -@pytest.mark.parametrize("appsec_enabled", [True, False]) -@pytest.mark.parametrize("iast_enabled", [True, False]) -def test_asm_standalone_configuration(sca_enabled, appsec_enabled, iast_enabled): - if not appsec_enabled and not iast_enabled and sca_enabled == "false": - pytest.skip("SCA, AppSec or IAST must be enabled") - - with override_env({"DD_APPSEC_SCA_ENABLED": sca_enabled}): - ddtrace.config._reset() - tracer = DummyTracer() - tracer.configure(appsec_enabled=appsec_enabled, iast_enabled=iast_enabled, apm_tracing_disabled=True) - if sca_enabled == "true": - assert bool(ddtrace.config._sca_enabled) is True - assert tracer.enabled is False - - assert isinstance(tracer._sampler.limiter, RateLimiter) - assert tracer._sampler.limiter.rate_limit == 1 - assert tracer._sampler.limiter.time_window == 60e9 - - assert tracer._span_aggregator.sampling_processor._compute_stats_enabled is False - - # reset tracer values - with override_env({"DD_APPSEC_SCA_ENABLED": "false"}): - ddtrace.config._reset() - tracer.configure(appsec_enabled=False, iast_enabled=False, apm_tracing_disabled=False) - def test_gc_not_used_on_root_spans(): gc.freeze() diff --git a/tests/tracer/test_tracer_appsec.py b/tests/tracer/test_tracer_appsec.py new file mode 100644 index 00000000000..db86b00210c --- /dev/null +++ b/tests/tracer/test_tracer_appsec.py @@ -0,0 +1,210 @@ +import pytest +import ddtrace +from ddtrace._trace.processor import SpanAggregator +from ddtrace.trace import Span +from ddtrace.internal.writer import AgentWriter +from ddtrace.internal.writer import NativeWriter +from ddtrace._trace.processor import TraceProcessor +from tests.appsec.utils import asm_context +from ddtrace.ext import SpanTypes +from ddtrace.ext import http +from ddtrace.ext import net +from ddtrace.contrib.internal import trace_utils +from tests.utils import DummyTracer +from tests.utils import override_env + + +class DummyProcessor(TraceProcessor): + def process_trace(self, trace): + return trace + + +@pytest.mark.parametrize("writer_class", (AgentWriter, NativeWriter)) +def test_aggregator_reset_with_args(writer_class): + """ + Validates that the span aggregator can reset trace buffers, sampling processor, + user processors/filters and trace api version (when ASM is enabled) + """ + + dd_proc = DummyProcessor() + user_proc = DummyProcessor() + aggr = SpanAggregator( + partial_flush_enabled=False, + partial_flush_min_spans=1, + dd_processors=[dd_proc], + user_processors=[user_proc], + ) + + aggr.writer = writer_class("http://localhost:8126", api_version="v0.5") + span = Span("span", on_finish=[aggr.on_span_finish]) + aggr.on_span_start(span) + + # Expect SpanAggregator to have the expected processors, api_version and span in _traces + assert dd_proc in aggr.dd_processors + assert user_proc in aggr.user_processors + assert span.trace_id in aggr._traces + assert len(aggr._span_metrics["spans_created"]) == 1 + assert aggr.writer._api_version == "v0.5" + # Expect the default value of apm_opt_out and compute_stats to be False + assert aggr.sampling_processor.apm_opt_out is False + assert aggr.sampling_processor._compute_stats_enabled is False + # Reset the aggregator with new args and new user processors and expect the new values to be set + aggr.reset(user_processors=[], compute_stats=True, apm_opt_out=True, appsec_enabled=True, reset_buffer=False) + assert aggr.user_processors == [] + assert dd_proc in aggr.dd_processors + assert aggr.sampling_processor.apm_opt_out is True + assert aggr.sampling_processor._compute_stats_enabled is True + assert aggr.writer._api_version == "v0.4" + assert span.trace_id in aggr._traces + assert len(aggr._span_metrics["spans_created"]) == 1 + + + +@pytest.mark.parametrize("appsec_enabled", [False, True]) +@pytest.mark.parametrize("span_type", [SpanTypes.WEB, SpanTypes.HTTP, None]) +@pytest.mark.parametrize( + "method,url,status_code,status_msg,query,request_headers,response_headers,uri,path_params,cookies,target_host", + [ + ("GET", "http://localhost/", 0, None, None, None, None, None, None, None, "localhost"), + ("GET", "http://localhost/", 200, "OK", None, None, None, None, None, None, "localhost"), + (None, None, None, None, None, None, None, None, None, None, None), + ( + "GET", + "http://localhost/", + 200, + "OK", + None, + {"my-header": "value1"}, + {"resp-header": "val"}, + "http://localhost/", + None, + None, + "localhost", + ), + ( + "GET", + "http://localhost/", + 200, + "OK", + "q=test+query&q2=val", + {"my-header": "value1"}, + {"resp-header": "val"}, + "http://localhost/search?q=test+query&q2=val", + {"id": "val", "name": "vlad"}, + None, + "localhost", + ), + ("GET", "http://user:pass@localhost/", 0, None, None, None, None, None, None, None, None), + ("GET", "http://user@localhost/", 0, None, None, None, None, None, None, None, None), + ("GET", "http://user:pass@localhost/api?q=test", 0, None, None, None, None, None, None, None, None), + ("GET", "http://localhost/api@test", 0, None, None, None, None, None, None, None, None), + ("GET", "http://localhost/?api@test", 0, None, None, None, None, None, None, None, None), + ], +) +def test_set_http_meta( + span, + int_config, + method, + url, + target_host, + status_code, + status_msg, + query, + request_headers, + response_headers, + uri, + path_params, + cookies, + appsec_enabled, + span_type, +): + int_config.myint.http.trace_headers(["my-header"]) + int_config.myint.http.trace_query_string = True + span.span_type = span_type + with asm_context(config={"_asm_enabled": appsec_enabled}): + trace_utils.set_http_meta( + span, + int_config.myint, + method=method, + url=url, + target_host=target_host, + status_code=status_code, + status_msg=status_msg, + query=query, + raw_uri=uri, + request_headers=request_headers, + response_headers=response_headers, + request_cookies=cookies, + request_path_params=path_params, + ) + if method is not None: + assert span.get_tag(http.METHOD) == method + else: + assert http.METHOD not in span.get_tags() + + if target_host is not None: + assert span.get_tag(net.TARGET_HOST) == target_host + else: + assert net.TARGET_HOST not in span.get_tags() + + if url is not None: + if url.startswith("http://user"): + # Remove any userinfo that may be in the original url + expected_url = url[: url.index(":")] + "://" + url[url.index("@") + 1 :] + else: + expected_url = url + + if query and int_config.myint.http.trace_query_string: + assert span.get_tag(http.URL) == str(expected_url + "?" + query) + else: + assert span.get_tag(http.URL) == str(expected_url) + else: + assert http.URL not in span.get_tags() + + if status_code is not None: + assert span.get_tag(http.STATUS_CODE) == str(status_code) + if 500 <= int(status_code) < 600: + assert span.error == 1 + else: + assert span.error == 0 + else: + assert http.STATUS_CODE not in span.get_tags() + + if status_msg is not None: + assert span.get_tag(http.STATUS_MSG) == str(status_msg) + + if query is not None and int_config.myint.http.trace_query_string: + assert span.get_tag(http.QUERY_STRING) == query + + if request_headers is not None: + for header, value in request_headers.items(): + tag = "http.request.headers." + header + assert span.get_tag(tag) == value + + +@pytest.mark.parametrize("sca_enabled", ["true", "false"]) +@pytest.mark.parametrize("appsec_enabled", [True, False]) +@pytest.mark.parametrize("iast_enabled", [True, False]) +def test_asm_standalone_configuration(sca_enabled, appsec_enabled, iast_enabled): + if not appsec_enabled and not iast_enabled and sca_enabled == "false": + pytest.skip("SCA, AppSec or IAST must be enabled") + + with override_env({"DD_APPSEC_SCA_ENABLED": sca_enabled}): + ddtrace.config._reset() + tracer = DummyTracer() + tracer.configure(appsec_enabled=appsec_enabled, iast_enabled=iast_enabled, apm_tracing_disabled=True) + if sca_enabled == "true": + assert bool(ddtrace.config._sca_enabled) is True + assert tracer.enabled is False + + assert isinstance(tracer._sampler.limiter, RateLimiter) + assert tracer._sampler.limiter.rate_limit == 1 + assert tracer._sampler.limiter.time_window == 60e9 + + assert tracer._span_aggregator.sampling_processor._compute_stats_enabled is False + + # reset tracer values + with override_env({"DD_APPSEC_SCA_ENABLED": "false"}): + ddtrace.config._reset() + tracer.configure(appsec_enabled=False, iast_enabled=False, apm_tracing_disabled=False) + From 62204db3aaedcddca4e596ce61bf3a1da608b8b7 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 14:56:55 +0100 Subject: [PATCH 03/18] fix lint and imports --- tests/tracer/test_trace_utils.py | 2 -- tests/tracer/test_tracer.py | 2 -- tests/tracer/test_tracer_appsec.py | 14 +++++++------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/tracer/test_trace_utils.py b/tests/tracer/test_trace_utils.py index f0636662358..17647b0bcae 100644 --- a/tests/tracer/test_trace_utils.py +++ b/tests/tracer/test_trace_utils.py @@ -386,8 +386,6 @@ def test_set_http_meta_with_http_header_tags_config(): assert response_span.get_tag("third-header") == "value3" - - @mock.patch("ddtrace.settings._config.log") @pytest.mark.parametrize( "error_codes,status_code,error,log_call", diff --git a/tests/tracer/test_tracer.py b/tests/tracer/test_tracer.py index f579d18b40a..7490ff89b55 100644 --- a/tests/tracer/test_tracer.py +++ b/tests/tracer/test_tracer.py @@ -31,7 +31,6 @@ from ddtrace.ext import user import ddtrace.internal from ddtrace.internal.compat import PYTHON_VERSION_INFO -from ddtrace.internal.rate_limiter import RateLimiter from ddtrace.internal.serverless import has_aws_lambda_agent_extension from ddtrace.internal.serverless import in_aws_lambda from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning @@ -1902,7 +1901,6 @@ def test_finish_span_with_ancestors(tracer): assert span3.finished - def test_gc_not_used_on_root_spans(): gc.freeze() diff --git a/tests/tracer/test_tracer_appsec.py b/tests/tracer/test_tracer_appsec.py index db86b00210c..b1e1844f4bc 100644 --- a/tests/tracer/test_tracer_appsec.py +++ b/tests/tracer/test_tracer_appsec.py @@ -1,15 +1,17 @@ import pytest + import ddtrace from ddtrace._trace.processor import SpanAggregator -from ddtrace.trace import Span -from ddtrace.internal.writer import AgentWriter -from ddtrace.internal.writer import NativeWriter from ddtrace._trace.processor import TraceProcessor -from tests.appsec.utils import asm_context +from ddtrace.contrib.internal import trace_utils from ddtrace.ext import SpanTypes from ddtrace.ext import http from ddtrace.ext import net -from ddtrace.contrib.internal import trace_utils +from ddtrace.internal.rate_limiter import RateLimiter +from ddtrace.internal.writer import AgentWriter +from ddtrace.internal.writer import NativeWriter +from ddtrace.trace import Span +from tests.appsec.utils import asm_context from tests.utils import DummyTracer from tests.utils import override_env @@ -59,7 +61,6 @@ def test_aggregator_reset_with_args(writer_class): assert len(aggr._span_metrics["spans_created"]) == 1 - @pytest.mark.parametrize("appsec_enabled", [False, True]) @pytest.mark.parametrize("span_type", [SpanTypes.WEB, SpanTypes.HTTP, None]) @pytest.mark.parametrize( @@ -207,4 +208,3 @@ def test_asm_standalone_configuration(sca_enabled, appsec_enabled, iast_enabled) with override_env({"DD_APPSEC_SCA_ENABLED": "false"}): ddtrace.config._reset() tracer.configure(appsec_enabled=False, iast_enabled=False, apm_tracing_disabled=False) - From bb06476a99a1e4396bb45580b6509689620e9b9e Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 15:12:57 +0100 Subject: [PATCH 04/18] add missing fixtures --- ...s.test_flush_spans_before_writer_recreate.json | 1 + tests/tracer/test_tracer_appsec.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json index 2c2fa9baddd..8fe9e022852 100644 --- a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json +++ b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json @@ -7,6 +7,7 @@ "span_id": 1, "parent_id": 0, "type": "", + "error": 0, "meta": { "_dd.p.dm": "-0", "_dd.p.tid": "6854a54200000000", diff --git a/tests/tracer/test_tracer_appsec.py b/tests/tracer/test_tracer_appsec.py index b1e1844f4bc..7596c1c6718 100644 --- a/tests/tracer/test_tracer_appsec.py +++ b/tests/tracer/test_tracer_appsec.py @@ -10,6 +10,8 @@ from ddtrace.internal.rate_limiter import RateLimiter from ddtrace.internal.writer import AgentWriter from ddtrace.internal.writer import NativeWriter +from ddtrace.settings._config import Config +from ddtrace.settings.integration import IntegrationConfig from ddtrace.trace import Span from tests.appsec.utils import asm_context from tests.utils import DummyTracer @@ -21,6 +23,19 @@ def process_trace(self, trace): return trace +@pytest.fixture +def int_config(): + c = Config() + c.myint = IntegrationConfig(c, "myint") + return c + + +@pytest.fixture +def span(tracer): + with tracer.trace(name="myint") as span: + yield span + + @pytest.mark.parametrize("writer_class", (AgentWriter, NativeWriter)) def test_aggregator_reset_with_args(writer_class): """ From 38e6e2cfc9986e4d38748f7bc5f5e171e56decff Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 17:09:32 +0100 Subject: [PATCH 05/18] generate tracestats --- ...st_flush_spans_before_writer_recreate.json | 20 ++++++++--------- ...ans_before_writer_recreate_tracestats.json | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json index 8fe9e022852..cfeac77af2d 100644 --- a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json +++ b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json @@ -10,18 +10,18 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "6854a54200000000", + "_dd.p.tid": "690cc7ff00000000", "language": "python", - "runtime-id": "b0e0b1b6ceee4ac18dc337bc1f9b6872" + "runtime-id": "17289030b19a46b3a51bdd6ae6ab01a8" }, "metrics": { "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 78381 + "process_id": 8646 }, - "duration": 40804000, - "start": 1750377794426724000 + "duration": 2863625, + "start": 1762445311732588883 }], [ { @@ -36,16 +36,16 @@ "meta": { "_dd.base_service": "ddtrace_subprocess_dir", "_dd.p.dm": "-0", - "_dd.p.tid": "6854a54200000000", + "_dd.p.tid": "690cc7ff00000000", "language": "python", - "runtime-id": "b0e0b1b6ceee4ac18dc337bc1f9b6872" + "runtime-id": "17289030b19a46b3a51bdd6ae6ab01a8" }, "metrics": { "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 78381 + "process_id": 8646 }, - "duration": 21000, - "start": 1750377794426242000 + "duration": 19041, + "start": 1762445311732400092 }]] diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json new file mode 100644 index 00000000000..c63c99e1db4 --- /dev/null +++ b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json @@ -0,0 +1,22 @@ +[ + { + "Start": 0, + "Duration": 10000000000, + "Stats": [ + { + "Name": "long_running_operation", + "Resource": "long_running_operation", + "Service": "ddtrace_subprocess_dir", + "Type": "", + "HTTPStatusCode": 0, + "Synthetics": false, + "Hits": 1, + "TopLevelHits": 1, + "Duration": 2863625, + "Errors": 0, + "OkSummary": 37, + "ErrorSummary": 24 + } + ] + } +] From 47206630c415d8e728657ec994c391c1cacb79b0 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 17:23:44 +0100 Subject: [PATCH 06/18] mv remote config appsec tests to appsec and update codeowners --- .github/CODEOWNERS | 3 +++ ...moteconfig_client.py => test_remoteconfig_appsec_client.py} | 0 ...ig_client_e2e.py => test_remoteconfig_appsec_client_e2e.py} | 0 3 files changed, 3 insertions(+) rename tests/internal/remoteconfig/{test_remoteconfig_client.py => test_remoteconfig_appsec_client.py} (100%) rename tests/internal/remoteconfig/{test_remoteconfig_client_e2e.py => test_remoteconfig_appsec_client_e2e.py} (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3e74e3caa89..25e2545affb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -127,8 +127,11 @@ tests/contrib/subprocess @DataDog/asm-python tests/snapshots/tests*appsec*.json @DataDog/asm-python tests/contrib/*/test*appsec*.py @DataDog/asm-python tests/contrib/*/test*iast*.py @DataDog/asm-python +tests/tracer/test*appsec*.py @DataDog/asm-python +tests/smoke_test.py @DataDog/asm-python @DataDog/profiling-python scripts/iast/* @DataDog/asm-python + # Profiling ddtrace/profiling @DataDog/profiling-python ddtrace/settings/profiling.py @DataDog/profiling-python diff --git a/tests/internal/remoteconfig/test_remoteconfig_client.py b/tests/internal/remoteconfig/test_remoteconfig_appsec_client.py similarity index 100% rename from tests/internal/remoteconfig/test_remoteconfig_client.py rename to tests/internal/remoteconfig/test_remoteconfig_appsec_client.py diff --git a/tests/internal/remoteconfig/test_remoteconfig_client_e2e.py b/tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py similarity index 100% rename from tests/internal/remoteconfig/test_remoteconfig_client_e2e.py rename to tests/internal/remoteconfig/test_remoteconfig_appsec_client_e2e.py From 00c2093dc2917de9265f82a17586fd092adf388a Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 6 Nov 2025 17:54:30 +0100 Subject: [PATCH 07/18] remove tracestats file --- ...ans_before_writer_recreate_tracestats.json | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json deleted file mode 100644 index c63c99e1db4..00000000000 --- a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate_tracestats.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "Start": 0, - "Duration": 10000000000, - "Stats": [ - { - "Name": "long_running_operation", - "Resource": "long_running_operation", - "Service": "ddtrace_subprocess_dir", - "Type": "", - "HTTPStatusCode": 0, - "Synthetics": false, - "Hits": 1, - "TopLevelHits": 1, - "Duration": 2863625, - "Errors": 0, - "OkSummary": 37, - "ErrorSummary": 24 - } - ] - } -] From 93a611ebffb3a94a7b60cec9bdbd34c9302bcc10 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 7 Nov 2025 11:11:43 +0100 Subject: [PATCH 08/18] update test-agent --- .gitlab/services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/services.yml b/.gitlab/services.yml index 07a48c88bc3..e512c996f6b 100644 --- a/.gitlab/services.yml +++ b/.gitlab/services.yml @@ -12,7 +12,7 @@ DD_REMOTE_CONFIGURATION_REFRESH_INTERVAL: 5s DD_DOGSTATSD_NON_LOCAL_TRAFFIC: true testagent: - name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.36.0 + name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.37.0 alias: testagent variables: LOG_LEVEL: ERROR From ecc0c73550198cafcac83bcf663685fa50660d38 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 7 Nov 2025 11:45:32 +0100 Subject: [PATCH 09/18] revert and codeowners update --- .github/CODEOWNERS | 7 ++++--- .gitlab/services.yml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 25e2545affb..558c52dab9a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -125,9 +125,6 @@ ddtrace/internal/iast/ @DataDog/asm-python tests/appsec/ @DataDog/asm-python tests/contrib/subprocess @DataDog/asm-python tests/snapshots/tests*appsec*.json @DataDog/asm-python -tests/contrib/*/test*appsec*.py @DataDog/asm-python -tests/contrib/*/test*iast*.py @DataDog/asm-python -tests/tracer/test*appsec*.py @DataDog/asm-python tests/smoke_test.py @DataDog/asm-python @DataDog/profiling-python scripts/iast/* @DataDog/asm-python @@ -254,3 +251,7 @@ tests/snapshots/tests.contrib.azure_servicebus.* @DataDog/serverless # Data Streams Monitoring ddtrace/internal/datastreams @DataDog/data-streams-monitoring tests/datastreams @DataDog/data-streams-monitoring + +# ASM (order matters) +tests/*/test*appsec*.py @DataDog/asm-python +tests/*/test*iast*.py @DataDog/asm-python diff --git a/.gitlab/services.yml b/.gitlab/services.yml index e512c996f6b..07a48c88bc3 100644 --- a/.gitlab/services.yml +++ b/.gitlab/services.yml @@ -12,7 +12,7 @@ DD_REMOTE_CONFIGURATION_REFRESH_INTERVAL: 5s DD_DOGSTATSD_NON_LOCAL_TRAFFIC: true testagent: - name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.37.0 + name: registry.ddbuild.io/images/mirror/dd-apm-test-agent/ddapm-test-agent:v1.36.0 alias: testagent variables: LOG_LEVEL: ERROR From 2b0214e33a2a2ab9ded194ba106b22a713a35c56 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 7 Nov 2025 14:19:59 +0100 Subject: [PATCH 10/18] fix stats snapshot --- tests/integration/test_integration_snapshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_integration_snapshots.py b/tests/integration/test_integration_snapshots.py index 8cfc778376c..7e32396d48a 100644 --- a/tests/integration/test_integration_snapshots.py +++ b/tests/integration/test_integration_snapshots.py @@ -46,7 +46,7 @@ def test_flush_spans_before_writer_recreate(): writer = tracer._span_aggregator.writer # Enable compute stats to trigger the recreation of the agent writer - tracer.configure(compute_stats_enabled=True) + tracer.configure(trace_processors=[]) assert tracer._span_aggregator.writer is not writer, "Writer should be recreated" # Finish the long running span after the writer has been recreated long_running_span.finish() From 4e0ee8cbd044809c91d3e48a9f180b933fda0952 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 7 Nov 2025 15:11:36 +0100 Subject: [PATCH 11/18] fixing ownership --- .github/CODEOWNERS | 9 ++++++--- tests/tracer/test_endpoint_config.py | 12 ++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 558c52dab9a..205b8847970 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -240,7 +240,7 @@ tests/contrib/azure_functions @DataDog/serverless tests/contrib/azure_functions_eventhubs @DataDog/serverless @DataDog/apm-serverless tests/contrib/azure_functions_servicebus @DataDog/serverless @DataDog/apm-serverless tests/contrib/azure_servicebus @DataDog/serverless @DataDog/apm-serverless -tests/internal/test_serverless.py @DataDog/apm-core-python @DataDog/apm-serverless +tests/internal/test_serverless.py @DataDog/apm-core-python @DataDog/apm-serverless @DataDog/asm-python tests/snapshots/tests.contrib.aws_lambda.*. @DataDog/apm-serverless tests/snapshots/tests.contrib.azure_eventhubs.* @DataDog/serverless @DataDog/apm-serverless tests/snapshots/tests.contrib.azure_functions.* @DataDog/serverless @DataDog/apm-serverless @@ -253,5 +253,8 @@ ddtrace/internal/datastreams @DataDog/data-streams-monitoring tests/datastreams @DataDog/data-streams-monitoring # ASM (order matters) -tests/*/test*appsec*.py @DataDog/asm-python -tests/*/test*iast*.py @DataDog/asm-python +tests/*/*/test*appsec*.py @DataDog/asm-python +tests/*/test*appsec*.py @DataDog/asm-python +tests/*/test*iast*.py @DataDog/asm-python +tests/*/*/test*iast*.py @DataDog/asm-python +tests/tracer/test_propagation.py @DataDog/apm-sdk-capabilities-python @DataDog/asm-python diff --git a/tests/tracer/test_endpoint_config.py b/tests/tracer/test_endpoint_config.py index df35d43e243..bce0a40b11f 100644 --- a/tests/tracer/test_endpoint_config.py +++ b/tests/tracer/test_endpoint_config.py @@ -23,7 +23,7 @@ def mock_getresponse_enabled_after_4_retries(self): response.status = 500 response.reason = "KO" else: - response.read.return_value = b'{"dd_iast_enabled": true}' + response.read.return_value = b'{"dd_product_enabled": true}' response.status = 200 response.reason = "OK" response.fp = BytesIO(response.read.return_value) @@ -34,7 +34,7 @@ def mock_getresponse_enabled_after_4_retries(self): def mock_getresponse_enabled(self): response = mock.Mock(spec=HTTPResponse) - response.read.return_value = b'{"dd_iast_enabled": true}' + response.read.return_value = b'{"dd_product_enabled": true}' response.status = 200 response.reason = "OK" response.chunked = False @@ -46,7 +46,7 @@ def mock_getresponse_enabled(self): def mock_getresponse_403(self): response = mock.Mock(spec=HTTPResponse) - response.read.return_value = b'{"dd_iast_enabled": true}' + response.read.return_value = b'{"dd_product_enabled": true}' response.status = 403 response.reason = "KO" response.chunked = False @@ -58,7 +58,7 @@ def mock_getresponse_403(self): def mock_getresponse_500(self): response = mock.Mock(spec=HTTPResponse) - response.read.return_value = b'{"dd_iast_enabled": true}' + response.read.return_value = b'{"dd_product_enabled": true}' response.status = 500 response.reason = "KO" response.chunked = False @@ -99,7 +99,7 @@ def test_set_config_endpoint_enabled(caplog): ), mock.patch.object( HTTPConnection, "getresponse", new=mock_getresponse_enabled ): - assert fetch_config_from_endpoint() == {"dd_iast_enabled": True} + assert fetch_config_from_endpoint() == {"dd_product_enabled": True} if caplog.text: assert "Configuration endpoint not set. Skipping fetching configuration." not in caplog.text assert "Failed to fetch configuration from endpoint" not in caplog.text @@ -181,4 +181,4 @@ def test_set_config_endpoint_retries(caplog): ), mock.patch( "ddtrace.settings.endpoint_config._get_retries", return_value=5 ): - assert fetch_config_from_endpoint() == {"dd_iast_enabled": True} + assert fetch_config_from_endpoint() == {"dd_product_enabled": True} From 06488874031e5f6a2bc890e99744aeebbbcaec58 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 7 Nov 2025 15:12:28 +0100 Subject: [PATCH 12/18] update ST --- .github/workflows/system-tests.yml | 6 +++--- .gitlab-ci.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/system-tests.yml b/.github/workflows/system-tests.yml index 2a0f91e41e2..374b65ef8c3 100644 --- a/.github/workflows/system-tests.yml +++ b/.github/workflows/system-tests.yml @@ -45,7 +45,7 @@ jobs: persist-credentials: false repository: 'DataDog/system-tests' # Automatically managed, use scripts/update-system-tests-version to update - ref: '279a4f17c9392157cdc106e627c2b57c2233899b' + ref: 'ce152c18fb007cb219000fdf33c8d16c50996c2d' - name: Download wheels to binaries directory uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 @@ -90,7 +90,7 @@ jobs: persist-credentials: false repository: 'DataDog/system-tests' # Automatically managed, use scripts/update-system-tests-version to update - ref: '279a4f17c9392157cdc106e627c2b57c2233899b' + ref: 'ce152c18fb007cb219000fdf33c8d16c50996c2d' - name: Build runner uses: ./.github/actions/install_runner @@ -275,7 +275,7 @@ jobs: persist-credentials: false repository: 'DataDog/system-tests' # Automatically managed, use scripts/update-system-tests-version to update - ref: '279a4f17c9392157cdc106e627c2b57c2233899b' + ref: 'ce152c18fb007cb219000fdf33c8d16c50996c2d' - name: Download wheels to binaries directory uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dfe5b8dc860..a75ccc84d05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,7 @@ variables: DD_VPA_TEMPLATE: "vpa-template-cpu-p70-10percent-2x-oom-min-cap" # CI_DEBUG_SERVICES: "true" # Automatically managed, use scripts/update-system-tests-version to update - SYSTEM_TESTS_REF: "279a4f17c9392157cdc106e627c2b57c2233899b" + SYSTEM_TESTS_REF: "ce152c18fb007cb219000fdf33c8d16c50996c2d" default: interruptible: true From d879211249a9240d974f1d2cd25c8c94e679c653 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Wed, 12 Nov 2025 14:36:02 +0100 Subject: [PATCH 13/18] fix for CI from Brett --- .gitlab/benchmarks/microbenchmarks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/benchmarks/microbenchmarks.yml b/.gitlab/benchmarks/microbenchmarks.yml index 7e2f105bf65..7eb345ee3c0 100644 --- a/.gitlab/benchmarks/microbenchmarks.yml +++ b/.gitlab/benchmarks/microbenchmarks.yml @@ -7,7 +7,7 @@ stages: variables: BENCHMARKING_IMAGE_REGISTRY: 486234852809.dkr.ecr.us-east-1.amazonaws.com MICROBENCHMARKS_CI_IMAGE: $BENCHMARKING_IMAGE_REGISTRY/ci/benchmarking-platform:dd-trace-py - PACKAGE_IMAGE: registry.ddbuild.io/images/mirror/pypa/manylinux2014_x86_64:2024-08-12-7fde9b1 + PACKAGE_IMAGE: registry.ddbuild.io/images/mirror/pypa/manylinux2014_x86_64:2025-04-12-5990e2d GITHUB_CLI_IMAGE: registry.ddbuild.io/images/dd-octo-sts-ci-base:2025.06-1 BENCHMARKING_BRANCH: dd-trace-py From 4b7859d1ebac477bd2be46837edd6f555253778c Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Wed, 12 Nov 2025 15:43:43 +0100 Subject: [PATCH 14/18] add Munir suggestions --- .github/CODEOWNERS | 8 +++----- tests/integration/test_integration_snapshots.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 205b8847970..ab9f0a7a1df 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -47,6 +47,7 @@ tests/utils.py @DataDog/python-guild tests/suitespec.yml @DataDog/python-guild @DataDog/apm-core-python tests/suitespec.py @DataDog/python-guild @DataDog/apm-core-python scripts/bump_ddtrace.py @DataDog/python-guild +tests/smoke_test.py @DataDog/python-guild # Core / Language Platform tests/internal @DataDog/apm-core-python @@ -125,7 +126,6 @@ ddtrace/internal/iast/ @DataDog/asm-python tests/appsec/ @DataDog/asm-python tests/contrib/subprocess @DataDog/asm-python tests/snapshots/tests*appsec*.json @DataDog/asm-python -tests/smoke_test.py @DataDog/asm-python @DataDog/profiling-python scripts/iast/* @DataDog/asm-python @@ -253,8 +253,6 @@ ddtrace/internal/datastreams @DataDog/data-streams-monitoring tests/datastreams @DataDog/data-streams-monitoring # ASM (order matters) -tests/*/*/test*appsec*.py @DataDog/asm-python -tests/*/test*appsec*.py @DataDog/asm-python -tests/*/test*iast*.py @DataDog/asm-python -tests/*/*/test*iast*.py @DataDog/asm-python +tests/**/*appsec* @DataDog/asm-python +tests/**/*iast* @DataDog/asm-python tests/tracer/test_propagation.py @DataDog/apm-sdk-capabilities-python @DataDog/asm-python diff --git a/tests/integration/test_integration_snapshots.py b/tests/integration/test_integration_snapshots.py index 7e32396d48a..2e15837916f 100644 --- a/tests/integration/test_integration_snapshots.py +++ b/tests/integration/test_integration_snapshots.py @@ -46,7 +46,7 @@ def test_flush_spans_before_writer_recreate(): writer = tracer._span_aggregator.writer # Enable compute stats to trigger the recreation of the agent writer - tracer.configure(trace_processors=[]) + tracer._recreate() assert tracer._span_aggregator.writer is not writer, "Writer should be recreated" # Finish the long running span after the writer has been recreated long_running_span.finish() From b01f537d819da45aaf18fbf976c2c03610cb76d7 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Wed, 12 Nov 2025 15:59:26 +0100 Subject: [PATCH 15/18] fix --- tests/integration/test_integration_snapshots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_integration_snapshots.py b/tests/integration/test_integration_snapshots.py index 2e15837916f..2a7cb1502ac 100644 --- a/tests/integration/test_integration_snapshots.py +++ b/tests/integration/test_integration_snapshots.py @@ -46,7 +46,7 @@ def test_flush_spans_before_writer_recreate(): writer = tracer._span_aggregator.writer # Enable compute stats to trigger the recreation of the agent writer - tracer._recreate() + tracer._recreate(reset_buffer=False) assert tracer._span_aggregator.writer is not writer, "Writer should be recreated" # Finish the long running span after the writer has been recreated long_running_span.finish() From 80cce7d93910f56c591822cce56a85014984c0ae Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 13 Nov 2025 11:08:59 +0100 Subject: [PATCH 16/18] revert snapshot --- ...st_flush_spans_before_writer_recreate.json | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json index cfeac77af2d..338c7f4b2ec 100644 --- a/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json +++ b/tests/snapshots/tests.integration.test_integration_snapshots.test_flush_spans_before_writer_recreate.json @@ -6,22 +6,20 @@ "trace_id": 0, "span_id": 1, "parent_id": 0, - "type": "", - "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "690cc7ff00000000", + "_dd.p.tid": "6854a54200000000", "language": "python", - "runtime-id": "17289030b19a46b3a51bdd6ae6ab01a8" + "runtime-id": "b0e0b1b6ceee4ac18dc337bc1f9b6872" }, "metrics": { "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 8646 + "process_id": 78381 }, - "duration": 2863625, - "start": 1762445311732588883 + "duration": 40804000, + "start": 1750377794426724000 }], [ { @@ -36,16 +34,16 @@ "meta": { "_dd.base_service": "ddtrace_subprocess_dir", "_dd.p.dm": "-0", - "_dd.p.tid": "690cc7ff00000000", + "_dd.p.tid": "6854a54200000000", "language": "python", - "runtime-id": "17289030b19a46b3a51bdd6ae6ab01a8" + "runtime-id": "b0e0b1b6ceee4ac18dc337bc1f9b6872" }, "metrics": { "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 8646 + "process_id": 78381 }, - "duration": 19041, - "start": 1762445311732400092 + "duration": 21000, + "start": 1750377794426242000 }]] From 06a76cae0b4a05cf963aa5219807fb3b1310326c Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 13 Nov 2025 11:12:07 +0100 Subject: [PATCH 17/18] lint --- tests/tracer/test_trace_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/tracer/test_trace_utils.py b/tests/tracer/test_trace_utils.py index 19143f8f3a8..36d900f5b5d 100644 --- a/tests/tracer/test_trace_utils.py +++ b/tests/tracer/test_trace_utils.py @@ -386,7 +386,6 @@ def test_set_http_meta_with_http_header_tags_config(): assert response_span.get_tag("third-header") == "value3" - @mock.patch("ddtrace.internal.settings._config.log") @pytest.mark.parametrize( "error_codes,status_code,error,log_call", From 9bfd5abc4d5c0ed62fb564a486043c0a6ab1b09a Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Thu, 13 Nov 2025 11:21:17 +0100 Subject: [PATCH 18/18] fix previous merge --- tests/tracer/test_tracer_appsec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tracer/test_tracer_appsec.py b/tests/tracer/test_tracer_appsec.py index 7596c1c6718..d99c573a36c 100644 --- a/tests/tracer/test_tracer_appsec.py +++ b/tests/tracer/test_tracer_appsec.py @@ -8,10 +8,10 @@ from ddtrace.ext import http from ddtrace.ext import net from ddtrace.internal.rate_limiter import RateLimiter +from ddtrace.internal.settings._config import Config +from ddtrace.internal.settings.integration import IntegrationConfig from ddtrace.internal.writer import AgentWriter from ddtrace.internal.writer import NativeWriter -from ddtrace.settings._config import Config -from ddtrace.settings.integration import IntegrationConfig from ddtrace.trace import Span from tests.appsec.utils import asm_context from tests.utils import DummyTracer