fix aliyun trace session_id (#22468)
This commit is contained in:
@@ -284,7 +284,8 @@ class AliyunDataTrace(BaseTraceInstance):
|
|||||||
else:
|
else:
|
||||||
node_span = self.build_workflow_task_span(trace_id, workflow_span_id, trace_info, node_execution)
|
node_span = self.build_workflow_task_span(trace_id, workflow_span_id, trace_info, node_execution)
|
||||||
return node_span
|
return node_span
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
logging.debug(f"Error occurred in build_workflow_node_span: {e}", exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_workflow_node_status(self, node_execution: WorkflowNodeExecution) -> Status:
|
def get_workflow_node_status(self, node_execution: WorkflowNodeExecution) -> Status:
|
||||||
@@ -306,7 +307,7 @@ class AliyunDataTrace(BaseTraceInstance):
|
|||||||
start_time=convert_datetime_to_nanoseconds(node_execution.created_at),
|
start_time=convert_datetime_to_nanoseconds(node_execution.created_at),
|
||||||
end_time=convert_datetime_to_nanoseconds(node_execution.finished_at),
|
end_time=convert_datetime_to_nanoseconds(node_execution.finished_at),
|
||||||
attributes={
|
attributes={
|
||||||
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id", ""),
|
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id") or "",
|
||||||
GEN_AI_SPAN_KIND: GenAISpanKind.TASK.value,
|
GEN_AI_SPAN_KIND: GenAISpanKind.TASK.value,
|
||||||
GEN_AI_FRAMEWORK: "dify",
|
GEN_AI_FRAMEWORK: "dify",
|
||||||
INPUT_VALUE: json.dumps(node_execution.inputs, ensure_ascii=False),
|
INPUT_VALUE: json.dumps(node_execution.inputs, ensure_ascii=False),
|
||||||
@@ -381,7 +382,7 @@ class AliyunDataTrace(BaseTraceInstance):
|
|||||||
start_time=convert_datetime_to_nanoseconds(node_execution.created_at),
|
start_time=convert_datetime_to_nanoseconds(node_execution.created_at),
|
||||||
end_time=convert_datetime_to_nanoseconds(node_execution.finished_at),
|
end_time=convert_datetime_to_nanoseconds(node_execution.finished_at),
|
||||||
attributes={
|
attributes={
|
||||||
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id", ""),
|
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id") or "",
|
||||||
GEN_AI_SPAN_KIND: GenAISpanKind.LLM.value,
|
GEN_AI_SPAN_KIND: GenAISpanKind.LLM.value,
|
||||||
GEN_AI_FRAMEWORK: "dify",
|
GEN_AI_FRAMEWORK: "dify",
|
||||||
GEN_AI_MODEL_NAME: process_data.get("model_name", ""),
|
GEN_AI_MODEL_NAME: process_data.get("model_name", ""),
|
||||||
@@ -415,7 +416,7 @@ class AliyunDataTrace(BaseTraceInstance):
|
|||||||
start_time=convert_datetime_to_nanoseconds(trace_info.start_time),
|
start_time=convert_datetime_to_nanoseconds(trace_info.start_time),
|
||||||
end_time=convert_datetime_to_nanoseconds(trace_info.end_time),
|
end_time=convert_datetime_to_nanoseconds(trace_info.end_time),
|
||||||
attributes={
|
attributes={
|
||||||
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id", ""),
|
GEN_AI_SESSION_ID: trace_info.metadata.get("conversation_id") or "",
|
||||||
GEN_AI_USER_ID: str(user_id),
|
GEN_AI_USER_ID: str(user_id),
|
||||||
GEN_AI_SPAN_KIND: GenAISpanKind.CHAIN.value,
|
GEN_AI_SPAN_KIND: GenAISpanKind.CHAIN.value,
|
||||||
GEN_AI_FRAMEWORK: "dify",
|
GEN_AI_FRAMEWORK: "dify",
|
||||||
|
Reference in New Issue
Block a user