-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use metric-schema to report JVM Buffer Pool metrics #2018
Conversation
Generate changelog in
|
tritium-metrics-jvm/src/main/java/com/palantir/tritium/metrics/jvm/JvmMetrics.java
Show resolved
Hide resolved
efbfbf0
to
5e48fb1
Compare
5e48fb1
to
98a4399
Compare
JvmBuffersMetrics jvmBuffersMetrics = JvmBuffersMetrics.of(registry); | ||
for (BufferPoolMXBean pool : ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class)) { | ||
String poolName = pool.getName(); | ||
if (poolName.equals("direct")) { |
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.
If you want to be particularly defensive against nulls, you could do something like this:
if (poolName.equals("direct")) { | |
if ("direct".equals(poolName)) { |
Or Objects.equals(poolName, "direct")
which handles both values being null (although that's impossible for a constant string). I wouldn't expect getName to ever return null either, but we've seen crazier things...
Entirely up to you whether to change this :-]
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.
Ah good call. I'll change this to the first idea: "direct".equals(poolName)
for the null protection.
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.
Thanks!
Released 0.93.0 |
Before this PR
We weren't using metric-schema when registering the JVM Buffer Pool metrics. Using metric-schema gives us some nice tooling, like markdown file generation allowing devs to find all published metrics easily.
After this PR
==COMMIT_MSG==
Use metric-schema to report JVM Buffer Pool metrics
==COMMIT_MSG==
Possible downsides?
N/A