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

Allow blacklisting of jvm metrics #696

Open
udesaiitrs opened this issue Mar 25, 2022 · 4 comments
Open

Allow blacklisting of jvm metrics #696

udesaiitrs opened this issue Mar 25, 2022 · 4 comments

Comments

@udesaiitrs
Copy link

udesaiitrs commented Mar 25, 2022

Hello, I was hoping to understand why certain JVM metrics (java.lang:*) cannot be blacklisted/removed via configuration of the javaagent? The exporter should include these as there can be instances like in our case where we do not want the duplicate JVM metrics because they are collected by another application.

For example, the following should work but doesn't I believe:

blacklistObjectNames: 
  - "java.nio:*"
  - "java.lang:*"
@udesaiitrs
Copy link
Author

I have found how there are many default exports registered:

I feel as though it would be a good option to implement a configuration option to allow these to be turned off (on by default), especially with the growing scenarios such as Kubernetes environments where all the extra metrics may not be needed.

Is this something that sounds plausible?

@gmariette
Copy link

will appreciate such feature to, to not spawn our Prom cluster with the jvm container metrics

@dhoard
Copy link
Collaborator

dhoard commented Jul 10, 2023

This sounds like a great enhancement. It would require changes to ...

https://github.com/prometheus/client_java/blob/main/simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/DefaultExports.java

... to allow unregistering the collectors to support dynamic configuration reloading.

@dhoard
Copy link
Collaborator

dhoard commented Aug 12, 2023

Or as an alternative not use DefaultExports.initialize(); but add configuration-specific options and call the underlying exports classes directly.

new BufferPoolsExports().register(registry);
new ClassLoadingExports().register(registry);
new CompilationExports().register(registry);
new GarbageCollectorExports().register(registry);
new MemoryAllocationExports().register(registry);
new MemoryPoolsExports().register(registry);
new StandardExports().register(registry);
new ThreadExports().register(registry);
new VersionInfoExports().register(registry);

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