-
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 process stats #12043
Update process stats #12043
Conversation
I'm updating the Nodes Stats and Nodes Info API piece by piece... Here is the @kimchy @rmuir @clintongormley Can you have a look please? thanks. |
} catch (Exception e) { | ||
// not available | ||
} | ||
getMaxFileDescriptorCountField = 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.
similar comment from my OS level review, extract it to a method to make sure we don't leak the method down the code
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.
Done.
left a couple of notes, more thoughts:
|
@@ -143,14 +143,22 @@ public boolean handle(int code) { | |||
StringHelper.randomId(); | |||
} | |||
|
|||
public static void initializeProbes() { |
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 this be package private? I think its not needed except by bootstrap and bootstrap for testing.
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.
Ok
@kimchy @rmuir I updated the code with your comments. Can you please look again? thanks.
I removed process cpu user/sys time. I also added a
Calculating user cpu time for the process using threads takes ~0.03 ms. The last benchmark test uses |
Method method = osMxBean.getClass().getDeclaredMethod(methodName); | ||
method.setAccessible(true); | ||
return method; | ||
} catch (Exception e) { |
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 catch Throwable here and in the rest of the code in this class?
left a minor comment, LGTM otherwise |
0f4b55d
to
1c5d8ef
Compare
elapsed, (elapsed / (double)ITERATIONS), ITERATIONS, (sum / (double)ITERATIONS)); | ||
|
||
/* Commented as com.sun.management is listed as forbidden usage | ||
if (threadMxBean instanceof com.sun.management.ThreadMXBean) { |
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.
We can use the SuppressForbidden annotation on top of the class to fix this.
Thanks for investigating the performance! I think the benchmark is useful because in the past, there has been issues with stats apis being on the slow side. |
++, it helps us decide if we want to add it down the road |
This pull request:
process.mem.resident
,process.mem.share