Skip to content

Commit 55ff075

Browse files
committed
use provided timestamp from step function
1 parent f524509 commit 55ff075

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

datadog_lambda/tracing.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,8 +1303,15 @@ def create_inferred_span_from_eventbridge_event(event, context):
13031303
synchronicity="async",
13041304
tag_source="self",
13051305
)
1306-
dt_format = "%Y-%m-%dT%H:%M:%SZ"
1307-
timestamp = event.get("time")
1306+
1307+
# Use more granular timestamp from upstream Step Function if possible
1308+
if is_step_function_event(event.get("detail")):
1309+
timestamp = event.get("detail").get("_datadog").get("State").get("EnteredTime")
1310+
dt_format = "%Y-%m-%dT%H:%M:%S.%fZ"
1311+
else:
1312+
timestamp = event.get("time")
1313+
dt_format = "%Y-%m-%dT%H:%M:%SZ"
1314+
13081315
dt = datetime.strptime(timestamp, dt_format)
13091316

13101317
tracer.set_tags(_dd_origin)

0 commit comments

Comments
 (0)