feat(telemetry): add input/output token metrics and fix trace cleanup

- Add dify.tokens.input and dify.tokens.output OTEL metrics
- Remove token split from trace log attributes (keep metrics only)
- Emit split token metrics for workflows and node executions
- Gracefully handle trace file deletion failures to prevent task crashes

BREAKING: None
MIGRATION: None
This commit is contained in:
GareArc
2026-02-03 21:05:10 -08:00
parent 8ceb1ed96f
commit e67afa7a5b
4 changed files with 25 additions and 5 deletions

View File

@ -65,4 +65,12 @@ def process_trace_tasks(file_info):
redis_client.incr(failed_key)
logger.info("Processing trace tasks failed, app_id: %s", app_id)
finally:
storage.delete(file_path)
try:
storage.delete(file_path)
except Exception as e:
logger.warning(
"Failed to delete trace file %s for app_id %s: %s",
file_path,
app_id,
e,
)