From f721c778ad84440c634a66de942385cb712a80d9 Mon Sep 17 00:00:00 2001 From: Anubhav Singh Date: Fri, 5 Sep 2025 06:54:59 +0530 Subject: [PATCH] fix: Ensure the order of execution steps are correct when logging with Weave by W&B (#25183) --- api/core/ops/weave_trace/weave_trace.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/core/ops/weave_trace/weave_trace.py b/api/core/ops/weave_trace/weave_trace.py index 808986048..8eb94cc67 100644 --- a/api/core/ops/weave_trace/weave_trace.py +++ b/api/core/ops/weave_trace/weave_trace.py @@ -120,7 +120,7 @@ class WeaveDataTrace(BaseTraceInstance): workflow_attributes["trace_id"] = trace_id workflow_attributes["start_time"] = trace_info.start_time workflow_attributes["end_time"] = trace_info.end_time - workflow_attributes["tags"] = ["workflow"] + workflow_attributes["tags"] = ["dify_workflow"] workflow_run = WeaveTraceModel( file_list=trace_info.file_list, @@ -156,6 +156,9 @@ class WeaveDataTrace(BaseTraceInstance): workflow_run_id=trace_info.workflow_run_id ) + # rearrange workflow_node_executions by starting time + workflow_node_executions = sorted(workflow_node_executions, key=lambda x: x.created_at) + for node_execution in workflow_node_executions: node_execution_id = node_execution.id tenant_id = trace_info.tenant_id # Use from trace_info instead