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

Improve the psutil builtins #185

Merged
merged 1 commit into from
Apr 5, 2024
Merged

Conversation

rokostik
Copy link
Contributor

@rokostik rokostik commented Apr 5, 2024

Changes

  • import github.com/shirou/gopsutil/v3 to use the latest version of the library

  • move psutil to devops context

  • new functions

    • host-info?
    • users?
    • load-avg?
    • disk-usage?
    • processes?
    • process

Where data is not available (usually because of lack of permission if not running under root) ??? is displayed instead.

I opted to use boxed types everywhere (just feels more appropriate to me). Although processes? takes a few seconds on my machine so if it needs to be fast I can change it to use unboxed types to construct the spreadsheet.

Copy link
Owner

@refaktor refaktor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that was really fast! Cool, I will try to test it a little and maybe prepare a little demo.

I haven't tested this but I suspect processes? takes few seconds because of OS reasons, I doubt boxing would affect this unless we arrive in the range of around at least 100k values.

@refaktor refaktor merged commit 482fe92 into refaktor:main Apr 5, 2024
7 checks passed
@refaktor
Copy link
Owner

refaktor commented Apr 5, 2024

@rokostik Do you think there are more useful functions in gopsutil library? Also if you have any ideas for other "devops" related go libraries let me know.

@rokostik
Copy link
Contributor Author

rokostik commented Apr 6, 2024

I haven't tested this but I suspect processes? takes few seconds because of OS reasons, I doubt boxing would affect this unless we arrive in the range of around at least 100k values.

TBH I haven't measured it but that would make more sense yes.

Do you think there are more useful functions in gopsutil library?

One thing that I think would be usefull is process management (stop, kill, etc.)

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

Successfully merging this pull request may close these issues.

2 participants