From 6ff80fbdae9bef58fa42e23a14dce70d64fde2b0 Mon Sep 17 00:00:00 2001 From: erikayasuda Date: Wed, 18 Sep 2024 14:50:51 -0400 Subject: [PATCH 1/2] noramlized _dd.parent_id value --- ddapm_test_agent/trace_snapshot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ddapm_test_agent/trace_snapshot.py b/ddapm_test_agent/trace_snapshot.py index d3fb2076..f8ab259f 100644 --- a/ddapm_test_agent/trace_snapshot.py +++ b/ddapm_test_agent/trace_snapshot.py @@ -106,10 +106,13 @@ def _normalize_traces(traces: List[Trace]) -> List[Trace]: span["parent_id"] = span_id_map.get(parent_id, parent_id) else: # Normalize the parent of root spans to be 0. + parent_id = 0 span["parent_id"] = 0 if "meta" not in span: span["meta"] = {} + elif span["meta"].get("_dd.parent_id"): + span["meta"]["_dd.parent_id"] = parent_id if "metrics" not in span: span["metrics"] = {} span_id += 1 From a4575fd8b3c04a007d838bcf9d789b829fb5baa0 Mon Sep 17 00:00:00 2001 From: erikayasuda Date: Wed, 18 Sep 2024 15:04:23 -0400 Subject: [PATCH 2/2] type cast from int to str --- ddapm_test_agent/trace_snapshot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddapm_test_agent/trace_snapshot.py b/ddapm_test_agent/trace_snapshot.py index f8ab259f..82ac6938 100644 --- a/ddapm_test_agent/trace_snapshot.py +++ b/ddapm_test_agent/trace_snapshot.py @@ -112,7 +112,7 @@ def _normalize_traces(traces: List[Trace]) -> List[Trace]: if "meta" not in span: span["meta"] = {} elif span["meta"].get("_dd.parent_id"): - span["meta"]["_dd.parent_id"] = parent_id + span["meta"]["_dd.parent_id"] = str(parent_id) if "metrics" not in span: span["metrics"] = {} span_id += 1