8000 Fix bug with how parentID is set · DataDog/datadog-lambda-python@9a89c27 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a89c27

Browse files
committed
Fix bug with how parentID is set
1 parent 0b3894a commit 9a89c27

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

datadog_lambda/trace_intake.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ def convert_trace_to_protobuf_payload(trace):
4646
else:
4747
span_groups[trace_id] = span_group
4848

49+
parent_id = 0
50+
51+
if "parent_id" in span and span["parent_id"]:
52+
parent_id = int(span["parent_id"])
53+
4954
args = {
5055
"service": span["service"],
5156
"name": span["name"],
5257
"resource": span["resource"],
5358
"traceID": trace_id,
5459
"spanID": int(span["span_id"]),
60+
"parentID": parent_id,
5561
"start": span["start"],
5662
"duration": span["duration"],
5763
"error": span["error"],
@@ -60,9 +66,6 @@ def convert_trace_to_protobuf_payload(trace):
6066
"type": "",
6167
}
6268

63-
if "parent_id" in span:
64-
args["parentID"] = int(span["parent_id"])
65-
6669
span_group.append(Span(**args))
6770

6871
traces = []
@@ -76,7 +79,7 @@ def convert_trace_to_protobuf_payload(trace):
7679
endTime=first_span.start + first_span.duration,
7780
)
7881
)
79-
trace_payload = TracePayload(hostName="none", env="none", traces=traces)
82+
trace_payload = TracePayload(hostName=None, env="none", traces=traces)
8083
return trace_payload
8184

8285

0 commit comments

Comments
 (0)
0