-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Update OS stats #12049
Update OS stats #12049
Conversation
Note: similar to what has been done in #12043, we can also use |
// not available | ||
|
||
} | ||
getFreePhysicalMemorySize = method; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a helper method that gets the method and makes it accessible? and then have getFreePhysicalMemorySize = getMethod("getFreePhysicalMemorySize ")
. This will simplify the code, and also fix the bug here where if we fail one of the following code fails, we will assign the same method to a different method handler
left a few comments, I would also change to only have "getters" in our Info/Stats classes (we are moving towards that). Also, great idea on having arch and such in os info |
d2dd014
to
b3e3949
Compare
@kimchy I updated the code with your comments, including Benchmark results (100 000 iterations for each method):
|
LGTM. I think @rcmuir mentioned it on the other thread, but it would be nice (maybe in another change) to have the tests verify we get non -1 values for platform we know we support it, and -1 for platforms we know is not supported. This will help know where we need to potentially go the extra mile and see how we can support it for certain platform. |
@kimchy thanks!
I agree, this is a very pertinent suggestion. I'll do it in another pull request. |
The The change also presents problems for the future, if we can actually get all 3 load values down the road then the API has to be changed back and cause yet another break. Was this considered with changes like this? It's a bit late to actually fix it now, but I'd like for these breaks to be considered a bit harder with future changes. With the monitoring APIs specifically most consumers need to support multiple major versions at the same time. |
This pull request:
os.uptime_in_millis
os.cpu
os.cpu.sys
os.cpu.user
os.cpu.idle
os.cpu.usage
os.cpu.stolen
os.mem.actual_free_in_bytes
os.mem.actual_used_in_bytes
os.cpu.vendor
os.cpu.model
os.cpu.mhz
os.cpu.total_cores
os.cpu.total_sockets
os.cpu.cores_per_socket
os.cpu.cache_size
Besides
os.name
we could also provideos.arch
andos.version
usingorg.apache.lucene.util.Constants
.