getumbrel / umbrel

A beautiful home server OS for self-hosting with an app store. Buy a pre-built Umbrel Home with umbrelOS, or install on a Raspberry Pi or any x86 system.
https://umbrel.com
Other
7.72k stars 544 forks source link

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

Open tomaspecl opened 2 months ago

tomaspecl commented 2 months ago

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: https://github.com/getumbrel/umbrel/blob/7103e98909041bb8e15702b4b2e3e7f78da4b351/packages/umbreld/source/modules/system-widgets.ts#L54

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 commented 2 months ago

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