After upgraded v1.0.0,The Statistics of Token is 0
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.0.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Just install and chat with the chatbot,The statistics of token is 0.
✔️ Expected Behavior
Accurately calculate token consumption
❌ Actual Behavior
Hello @ccooder! I'm here to help you with bugs, questions, and becoming a contributor. Let's work together to resolve the issue you're facing.
I found a similar open issue regarding abnormal token count display on the monitoring interface [1]. However, no solution was found in the comments of that issue.
For your specific problem, there have been recent changes in the codebase related to token statistics that might be relevant. These include altering the total_tokens column in the workflow_runs table from an INTEGER type to a BigInteger type to accommodate larger values, and the addition of a new API endpoint to provide daily token cost statistics [2][3][4].
Additionally, there is logging information available that could help identify why token statistics might be zero. The logger is used to log errors when there is a failure to extract usage data, which might be useful for debugging [5][6].
You might want to check these areas in your setup to ensure everything is configured correctly and that there are no errors being logged that could indicate the source of the issue.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
I also encountered this problem { "text": "print………………", "usage": { "prompt_tokens": 0, "prompt_unit_price": "0", "prompt_price_unit": "0", "prompt_price": "0", "completion_tokens": 0, "completion_unit_price": "0", "completion_price_unit": "0", "completion_price": "0", "total_tokens": 0, "total_price": "0", "currency": "USD", "latency": 3.0446406310002203 }, "finish_reason": "stop" }
Hi, @ccooder. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.
Issue Summary:
- Bug reported in Dify version 1.0.0: token statistics display as zero after upgrading.
- Occurs in a self-hosted Docker environment when using the chatbot.
- I suggested checking codebase changes and reviewing logs for errors.
- User zishun797 confirmed the issue with JSON output showing zero values.
- No resolution has been identified in the comments.
Next Steps:
- Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
- If no further input is provided, the issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!