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

includeObjectNames option issue #879

Closed
baribalbear opened this issue Oct 3, 2023 · 5 comments
Closed

includeObjectNames option issue #879

baribalbear opened this issue Oct 3, 2023 · 5 comments

Comments

@baribalbear
Copy link

baribalbear commented Oct 3, 2023

Hi All.

We are running "JBoss EAP 7.4.6.GA (WildFly Core 15.0.15.Final-redhat-00001)"

We are having slow scraping performance (up2 15+sec). I found such issue:

#246
#284

We would like to get data from some specific MBeans only. Was testing with "java.lang:*". While using below configuration it is working blazing fast (less than 1sec) and gets data from those MBeans only as required:

whitelistObjectNames: ["java.lang:*"]

However I found such statement in the docs:

Both whitelistObjectNames and blacklistObjectNames are still supported for backward compatibility, but should be considered deprecated.

So I would assume includeObjectNames param should be used instead nowadays?

But when I put:

includeObjectNames: ["java.lang:*"]

It does nothing - very long scraping time and gets all MBeans.

Could you please tell what is recommended settings to get only specific MBeans and have the great scraping performance now? Is it still whitelistObjectNames?

Of course I also tried it with:

rules:
- pattern: "java.lang*"

Yes, I get only specific MBeans data but the scraping speed is very slow comparing to using whitelistObjectNames. So it looks like it fetches all possible MBeans data and only after that does the filtering.

@dhoard
Copy link
Collaborator

dhoard commented Oct 3, 2023

Which version of the JMX Exporter are you using?
Can you share your exporter YAML?

includeObjectNames should work exactly like whitelistObjectNames
excludeObjectNames should work exactly like blacklistObjectNames

// Default to includeObjectNames, but fall back to whitelistObjectNames for backward
// compatibility
if (yamlConfig.containsKey("includeObjectNames")) {
List<Object> names = (List<Object>) yamlConfig.get("includeObjectNames");
for (Object name : names) {
cfg.includeObjectNames.add(new ObjectName((String) name));
}
} else if (yamlConfig.containsKey("whitelistObjectNames")) {
List<Object> names = (List<Object>) yamlConfig.get("whitelistObjectNames");
for (Object name : names) {
cfg.includeObjectNames.add(new ObjectName((String) name));
}
} else {
cfg.includeObjectNames.add(null);
}
// Default to excludeObjectNames, but fall back to blacklistObjectNames for backward
// compatibility
if (yamlConfig.containsKey("excludeObjectNames")) {
List<Object> names = (List<Object>) yamlConfig.get("excludeObjectNames");
for (Object name : names) {
cfg.excludeObjectNames.add(new ObjectName((String) name));
}
} else if (yamlConfig.containsKey("blacklistObjectNames")) {
List<Object> names = (List<Object>) yamlConfig.get("blacklistObjectNames");
for (Object name : names) {
cfg.excludeObjectNames.add(new ObjectName((String) name));
}
}

whitelistObjectNames and blacklistObjectNames are still supported functionality to prevent breaking prior installations that use them, but the long-term goal is to remove their use.

@baribalbear
Copy link
Author

baribalbear commented Oct 3, 2023

Which version of the JMX Exporter are you using?
Can you share your exporter YAML?

Hi there. I am using this version

#Generated by Maven
#Tue Mar 07 21:57:17 CET 2023
groupId=io.prometheus.jmx
artifactId=jmx_prometheus_javaagent
version=0.18.0

The config looks like:

---
includeObjectNames: ["java.lang:*"]
rules:
- pattern: "java.lang*"

@dhoard dhoard removed the type: bug label Oct 3, 2023
@dhoard
Copy link
Collaborator

dhoard commented Oct 3, 2023

This change was introduced into 0.20.0. I would suggest you upgrade due to other performance enhancements in 0.20.0.

@twoyang0917
Copy link

could you update README file of the repository to make it consistent.
currently it told me to download version 0.19.0 but the example of config file used includeObjectNames which it's fault.
I may have to spend more time to found this issue.

@dhoard
Copy link
Collaborator

dhoard commented Jan 23, 2024

could you update README file of the repository to make it consistent. currently it told me to download version 0.19.0 but the example of config file used includeObjectNames which it's fault. I may have to spend more time to found this issue.

I have updated README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants