【Bug】API trace total time not equal to conversation display time
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
### Dify version
1.15.0
### Cloud or Self Hosted
Self Hosted (Docker)
### Steps to reproduce
1. Call Dify conversation/workflow REST API with trace enabled.
2. Extract the trace array from API response, sum up the `elapsed_time` of all trace nodes manually.
3. Navigate to the conversation detail page using the corresponding conversation ID.
4. Record the conversation duration displayed on the page.
5. Compare the summed trace time and the page-displayed duration.
### ✔️ Expected Behavior
1. If the two metrics have different statistical calibers, there should be clear description and tooltip on UI and documents to distinguish them.
2. If they are supposed to represent the same metric, the summed trace elapsed time should equal the conversation duration shown on the conversation detail page.
3. No duplicate counting or missing counting of node elapsed time in trace calculation.
### ❌ Actual Behavior
The total time obtained by summing the `elapsed_time` of each node in the API trace is not equal to the conversation duration displayed on the conversation detail page. There is an obvious deviation between the two values. It is unclear whether this is caused by different statistical logic or a counting bug.
Contributor guide
Research direction
Reproduce the mismatch on Dify 1.15.0 using a conversation or workflow REST API call with trace enabled. Compare the trace nodes' elapsed_time values with the duration shown for the same conversation ID, then inspect the API trace calculation and conversation detail display paths to determine whether their metric definitions differ or whether nodes are counted incorrectly. Done means the metrics agree or their different scopes are clearly documented in the UI and documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, python, typescript
- Domain
- backend-api-design, frontend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100