I trying to use JMX Export to export some custom variables via Mbean. I am able to see the Mbean in jconsole but those attributes are not available in localhost:port\metrics. Tried whitelisting object name, changing patterns in rules but nothing seems to work.
Not sure if bean is exposed properly :/
package com.test;
public interface ApplicationInfoMXBean {
public String getEnv();
}
package com.test;
public class ApplicationInfoImp implements ApplicationInfoMXBean{
@Override
public String getEnv() {
return "XX";
}
Bean declaration:
MBeanServer mbeanServer=ManagementFactory.getPlatformMBeanServer();
ApplicationInfoMXBean appInfoObj=new ApplicationInfoImp();
ObjectName objName=new ObjectName("com.test:type=basic,name=ApplicationInfoImp");
mbeanServer.registerMBean(appInfoObj, objName);
config.yaml
rules:
- pattern: ".*"
The Prometheus JMX exporter doesn't export MBean String attributes since these aren't really metrics.