go-sysinfo
go-sysinfo copied to clipboard
LoadAverage() Where is this used?
I'm looking at using your library to provide cross-platform (Linux, BSD and Darwin) System Information, but going through the docs and codebase I don't see where .LoadAverage() is ever used or the interface.
Is this just missing?
This looks like an oversight. LoadAverage should have been implemented for both linux and darwin providers as they both support this metric.
When will this be implemented? I could use it in my project. Thanks!
I guess someone needs to put up a PR 👌
So I would like to give it a try!
@andrewkroh any info about the status? Saw the reference in your other repository about merging both projects into a single one so maybe this is a bit pointless to work on?
There no one slated to work on that merging of features from elastic-agent-system-metrics currently. So I recommend opening a PR to expedite this. Thanks.
@andrewkroh Before opening a PR (since I haven't implemented it in the darwin provider), would you like to take a look at the implementation in the linux provider? Here is the commit.
Also, any advice on how to do it for the darwin provider besides spinning up a VM? I guess that there should be a better way to do it, but you tell me.
Thanks for the time!
Code looks good to me 👌 I can help test the Darwin version? 🤔
@prologic My main problem is on how to code it without testing while doing so :sweat:
Should I just make the PR with the Linux changes and wait for someone else to open one for the darwin provider? Let's see what Andrew tells us!
What about you mock the expected data sources you expect to use/open/read on Darwin? 😅
What about you mock the expected data sources you expect to use/open/read on Darwin? sweat_smile
I can, but as far as I know, Darwin does not have the /proc/loadavg file, and needs to use sysctl vm.loadavg instead. I think the output is way different from Linux, so I can't mock something that I don't know how it should be mocked.
Anyway, I'm setting up a VM so I will get to work on it ASAP, no worries.
But you can define an interface that is common and implement the interface right?
@andrewkroh I just created a PR for this.
@prologic You can test it now! As you can see, it was a bit more complicated, and some things needed to be tested in the system itself instead of mocking things up.
Please, let me know if any work is needed or if anything is not worked as expected.