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

Added code to skip RuntimeMXBean attributes #859

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions collector/src/main/java/io/prometheus/jmx/JmxScraper.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ private void scrapeBean(MBeanServerConnection beanConn, ObjectName mBeanName) {
for (Object object : attributes) {
if (object instanceof Attribute) {
Attribute attribute = (Attribute) object;
String attributeName = attribute.getName();
if (mBeanName.toString().equals("java.lang:type=Runtime")
&& (attributeName.equalsIgnoreCase("SystemProperties")
|| attributeName.equalsIgnoreCase("ClassPath")
|| attributeName.equalsIgnoreCase("BootClassPath"))
|| attributeName.equalsIgnoreCase("LibraryPath")) {
// Skip attributes for the "java.lang:type=Runtime" MBean because
// getting the values is expensive and the values are ultimately ignored
continue;
} else if (mBeanName.toString().equals("jdk.management.jfr:type=FlightRecorder")) {
// Skip the FlightRecorderMXBean
continue;
}

MBeanAttributeInfo mBeanAttributeInfo = name2MBeanAttributeInfo.get(attribute.getName());
logScrape(mBeanName, mBeanAttributeInfo, "process");
processBeanValue(
Expand Down