diff --git a/ddtrace/_trace/processor/__init__.py b/ddtrace/_trace/processor/__init__.py index f8e2dbe749d..3657ee79c39 100644 --- a/ddtrace/_trace/processor/__init__.py +++ b/ddtrace/_trace/processor/__init__.py @@ -136,7 +136,9 @@ def process_trace(self, trace: List[Span]) -> Optional[List[Span]]: root_ctx = chunk_root._context if self.apm_opt_out: - chunk_root.set_metric(MK_APM_ENABLED, 0) + for span in trace: + if span._local_root_value is None: + span.set_metric(MK_APM_ENABLED, 0) # only trace sample if we haven't already sampled if root_ctx and root_ctx.sampling_priority is None: diff --git a/releasenotes/notes/fix_asm_standalone_span_tag-60b38c1d9d2efbaa.yaml b/releasenotes/notes/fix_asm_standalone_span_tag-60b38c1d9d2efbaa.yaml new file mode 100644 index 00000000000..f92914f931e --- /dev/null +++ b/releasenotes/notes/fix_asm_standalone_span_tag-60b38c1d9d2efbaa.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + ASM: This fix resolves an issue where some root span where not appropriately tagged for ASM standalone.