javaspringspring-bootprometheusjmx-exporter

can "jmx exporter" be used without compliling my spring boot Application in jar file?


In official git repository (https://github.com/prometheus/jmx_exporter), i see i need to use this command "java -javaagent:./jmx_prometheus_javaagent-0.16.1.jar=8080:config.yaml -jar yourJar.jar ". I am running my Spring Boot Application in my eclipse without compiling in jar format.

So how can i get the metrics from jmx exporter without compiling my spring app in jar file. Can anybody pls help me solve this issue.


Solution

  • You need to modify "Run configuration" in your Eclipse IDE to include necessary JVM arguments as you shown in question (java -javaagent:./jmx_prometheus_javaagent-0.16.1.jar=8080:config.yaml). For details check this answer on how to do it.

    Jar file (jmx_prometheus_javaagent-0.16.1.jar) and YAML file (config.yaml) has to be in current working directory, otherwise you might need to provide full path.