fiber icon indicating copy to clipboard operation
fiber copied to clipboard

🐛 [Bug]: Middleware Monitor "CPU Usage" is a "static value".

Open nyufeng opened this issue 1 year ago • 2 comments

Bug Description

When I use "Monitor", I found that the value of "CPU Usage" of the program does not change, but the CPU usage of the program has been changing dynamically by top or htop. The system "CPU" is also changing dynamically. After reading the source code, I found that this value is the average value since the program started, and does not reflect the current load of the program in real time. I hope to improve it.

How to Reproduce

monitor.New()

Expected Behavior

Dynamically changing like top.

Fiber Version

v2.52.4

Code Snippet (optional)

No response

Checklist:

  • [X] I agree to follow Fiber's Code of Conduct.
  • [X] I have checked for existing issues that describe my problem prior to opening this one.
  • [X] I understand that improperly formatted bug reports may be closed without explanation.

nyufeng avatar Apr 23 '24 07:04 nyufeng

Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

welcome[bot] avatar Apr 23 '24 07:04 welcome[bot]

If you're wondering the same thing, here's how to fix it https://github.com/nyufeng/fiber-monitor

nyufeng avatar May 07 '24 06:05 nyufeng

@nyufeng Your fixes will be released in the next v2 release.

Fixed via #2984

gaby avatar Jun 29 '24 00:06 gaby