mirror of
https://github.com/langgenius/dify.git
synced 2026-03-14 13:51:33 +08:00
fix(telemetry): populate missing fields in node execution trace
- Extract model_provider/model_name from process_data (LLM nodes store model info there, not in execution_metadata) - Add invoke_from to node execution trace metadata dict - Add credential_id to node execution trace metadata dict - Add conversation_id to metadata after message_id lookup - Add tool_name to tool_info dict in tool node
This commit is contained in:
parent
9c148218fc
commit
b710c9ad59
@ -464,6 +464,13 @@ class WorkflowPersistenceLayer(GraphEngineLayer):
|
||||
node_data["invoke_from"] = self._application_generate_entity.invoke_from.value
|
||||
node_data["user_id"] = self._system_variables().get(SystemVariableKey.USER_ID.value)
|
||||
|
||||
# Extract model info from process_data — LLM nodes store provider/model there,
|
||||
if domain_execution.process_data:
|
||||
if mp := domain_execution.process_data.get("model_provider"):
|
||||
node_data["model_provider"] = mp
|
||||
if mn := domain_execution.process_data.get("model_name"):
|
||||
node_data["model_name"] = mn
|
||||
|
||||
if domain_execution.node_type.value == "knowledge-retrieval" and domain_execution.outputs:
|
||||
results = domain_execution.outputs.get("result") or []
|
||||
dataset_ids: list[str] = []
|
||||
|
||||
@ -1183,10 +1183,12 @@ class TraceTask:
|
||||
"app_name": app_name,
|
||||
"workspace_name": workspace_name,
|
||||
"user_id": node_data.get("user_id"),
|
||||
"invoke_from": node_data.get("invoke_from"),
|
||||
"credential_id": node_data.get("credential_id"),
|
||||
"credential_name": credential_name,
|
||||
"dataset_ids": node_data.get("dataset_ids"),
|
||||
"dataset_names": node_data.get("dataset_names"),
|
||||
"plugin_name": node_data.get("plugin_name"),
|
||||
"credential_name": credential_name,
|
||||
}
|
||||
|
||||
parent_trace_context = node_data.get("parent_trace_context")
|
||||
@ -1207,6 +1209,8 @@ class TraceTask:
|
||||
if msg_id:
|
||||
message_id = str(msg_id)
|
||||
metadata["message_id"] = message_id
|
||||
if conversation_id:
|
||||
metadata["conversation_id"] = conversation_id
|
||||
|
||||
return WorkflowNodeTraceInfo(
|
||||
trace_id=self.trace_id,
|
||||
|
||||
@ -60,6 +60,7 @@ class ToolNode(Node[ToolNodeData]):
|
||||
tool_info = {
|
||||
"provider_type": self.node_data.provider_type.value,
|
||||
"provider_id": self.node_data.provider_id,
|
||||
"tool_name": self.node_data.tool_name,
|
||||
"plugin_unique_identifier": self.node_data.plugin_unique_identifier,
|
||||
"credential_id": self.node_data.credential_id,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user