refactor(observability): Phase2.2 成本归因 trace_id列+token日志写入+LLM/MCP/媒体子span [v2026.07.19.3]
CI / gate (push) Has been cancelled

This commit is contained in:
QihuAI Design committed 2026-07-19 08:51:28 +08:00
1 parent 6aefdfa5c2
commit a7a57f9a03
6 files changed
+3705 -3678

No files matched your search

+2 -1
View File
@@ -57,7 +57,7 @@ class LogService:
app_id: str = None, app_name: str = None,
conversation_id: str = None, prompt_tokens: int = 0,
completion_tokens: int = 0, total_tokens: int = 0,
cost: float = 0):
cost: float = 0, trace_id: str = None):
"""记录Token消耗日志"""
db = SessionLocal()
try:
@@ -73,6 +73,7 @@ class LogService:
completion_tokens=completion_tokens,
total_tokens=total_tokens,
cost=cost,
trace_id=trace_id,
)
db.add(log)
db.commit()