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

feat(api): add system stats (CPU and RAM usage) to API response #1047

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

skrashevich
Copy link
Contributor

@skrashevich skrashevich commented Apr 17, 2024

  • Implement GetCPUUsage and GetRAMUsage functions in core package for fetching CPU and memory usage.
  • Update apiHandler to include CPU and memory usage in the API response under "stats".
  • Ensure thread safety in apiHandler by properly using defer for mutex unlock.
  • Extend frontend to display fetched CPU and RAM usage statistics.
  • Add tests for new core functionality ensuring correct operation of system resource usage fetching.

depends on #1048

- Implement GetCPUUsage and GetRAMUsage functions in core package for fetching CPU and memory usage.
- Update apiHandler to include CPU and memory usage in the API response under "stats".
- Ensure thread safety in apiHandler by properly using defer for mutex unlock.
- Extend frontend to display fetched CPU and RAM usage statistics.
- Add tests for new core functionality ensuring correct operation of system resource usage fetching.
@AlexxIT
Copy link
Owner

AlexxIT commented Apr 20, 2024

Can we do same without 8 new dependencies?

- Updated `gopsutil` from v3 to v4.24.0-alpha.1 for enhanced system monitoring capabilities.
- Removed `go-astits` dependency as it's no longer required.
- Cleaned up `go.sum` by removing entries for unused dependencies.
@skrashevich
Copy link
Contributor Author

This number of dependencies is necessary to support most platforms on which go2rtc can theoretically be compiled. In fact, only 1-2 dependency code is included in the binary file, depending on the OS and architecture

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 22, 2024

What if we make support only for the main OS - Linux? Will the dependencies get a lot less complicated?

@AlexxIT AlexxIT added the doubt label Apr 22, 2024
@skrashevich
Copy link
Contributor Author

skrashevich commented Apr 23, 2024

What if we make support only for the main OS - Linux? Will the dependencies get a lot less complicated?

API handler should return a unified and predictable response, regardless of the OS running

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 23, 2024

Then there will be no such API at all inside go2rtc

@skrashevich
Copy link
Contributor Author

Then there will be no such API at all inside go2rtc

But the implementation in this PR provides unified and predictable response across OSes

@AlexxIT
Copy link
Owner

AlexxIT commented Apr 23, 2024

I don't want confusing dependencies inside the go.mod file. CPU stats are not worth it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants