GareArc
ff877ee39c
fix(telemetry): add resolved_trace_id property to eliminate trace_id inconsistencies
Add computed property to BaseTraceInfo that provides intelligent fallback:
1. External trace_id (from X-Trace-Id header)
2. workflow_run_id (for workflow-related traces)
3. message_id (as final fallback)
This ensures attribute dify.trace_id always matches log-level trace_id,
eliminating inconsistencies where attribute was null but log-level had value.
Changes:
- Add resolved_trace_id property to BaseTraceInfo (trace_entity.py)
- Replace 4 direct trace_id attribute assignments with resolved_trace_id
- Add trace_id_source parameter to 5 emit_metric_only_event calls
Fixes trace_id inconsistency found in MESSAGE_RUN, TOOL_EXECUTION,
MODERATION_CHECK, SUGGESTED_QUESTION_GENERATION, GENERATE_NAME_EXECUTION,
DATASET_RETRIEVAL, and PROMPT_GENERATION_EXECUTION events.
All 78 telemetry tests passing.
2026-02-28 20:32:15 -08:00
..
2026-02-05 23:10:30 -08:00
2026-02-05 23:10:30 -08:00
2025-09-18 12:49:10 +08:00
2026-02-05 23:10:30 -08:00
2026-01-27 10:48:42 +08:00
2026-01-06 15:23:50 +08:00
2026-01-30 19:18:49 +08:00
2025-09-15 13:06:33 +08:00
2025-10-10 23:41:16 +08:00
2025-09-15 13:06:33 +08:00
2026-01-31 18:00:56 +09:00
2026-01-31 18:00:56 +09:00
2026-02-06 01:06:07 -08:00
2026-02-05 23:10:30 -08:00
2026-01-30 02:38:57 +08:00
2025-10-28 09:59:30 +08:00
2026-01-30 20:19:35 +08:00
2026-02-05 23:10:30 -08:00
2026-02-28 20:32:15 -08:00
2026-01-30 19:18:49 +08:00
2025-12-09 14:41:46 +08:00
2026-02-05 23:10:30 -08:00
2026-01-30 19:18:49 +08:00
2026-01-31 18:00:56 +09:00
2026-02-28 19:27:24 -08:00
2026-02-05 23:10:30 -08:00
2026-01-30 16:05:02 +08:00
2026-01-13 23:39:34 +09:00
2026-02-05 23:10:30 -08:00
2025-09-10 01:54:26 +08:00
2026-01-08 13:17:30 +08:00
2026-02-02 19:07:30 +09:00
2025-12-09 14:41:46 +08:00
2026-01-08 13:17:30 +08:00