Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live Usage widget formats 100% CPU usage wrongly as 1.0e+2% #1911

Open
tomaspecl opened this issue Sep 20, 2024 · 1 comment
Open

Live Usage widget formats 100% CPU usage wrongly as 1.0e+2% #1911

tomaspecl opened this issue Sep 20, 2024 · 1 comment

Comments

@tomaspecl
Copy link

Sometimes the CPU usage is at 100% (and sometimes it shows more, don't ask me why or how). The Live Usage widget will show the CPU usage as "1.0e+2%"

The error is in the message itself that is retrieved by GET http://umbrel.local/trpc/widget.data?input={"widgetId":"umbrel:system-stats"}

One such message is here (this time it was 110% CPU usage apparently):
{"result":{"data":{"type":"three-stats","link":"?dialog=live-usage","refresh":10000,"items":[{"icon":"system-widget-cpu","subtext":"CPU","text":"1.1e+2%"},{"icon":"system-widget-memory","subtext":"Memory","text":"2.15 GB"},{"icon":"system-widget-storage","subtext":"Storage","text":"1.52 GB"}]}}}

I think I found the error in this code, it sets the precision to two decimal places which therefore has to show larger values than 99 in exponential notation:

text: `${cpuTotalUsed.toPrecision(2)}%`,

If I knew javascript I would try to fix it myself and do a pull request but I don't program in javascript (or typescript, it looks the same to me).

@mayankchhabra
Copy link
Member

Damn, thanks for reporting @tomaspecl. We'll get this fixed in the 1.3.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants