<p><a href="https://en.wikipedia.org/wiki/Java_Management_Extensions" rel="nofollow">https://en.wikipedia.org/wiki/Java_Management_Extensions</a></p>
<p>There is a less maintained lib, but it only provides read capability.
<a href="https://github.com/davecheney/gmx" rel="nofollow">https://github.com/davecheney/gmx</a></p>
<hr/>**评论:**<br/><br/>tv64738: <pre><p>Let's not call the concept of exporting metrics "JMX".</p>
<p>Also, might as well make it a Prometheus exporter.</p></pre>tex0: <pre><p>JMX is much more than metrics. But sure what OP is trying to say.</p></pre>wanghq: <pre><p>Exactly. I find that somehow I need two way communication, e.g. enable the detailed debugging on this host for a minute. AFAIK, Prometheus is not capable of "Consulting and changing application configuration" </p>
<p><a href="https://docs.oracle.com/javase/8/docs/technotes/guides/jmx/index.html" rel="nofollow">https://docs.oracle.com/javase/8/docs/technotes/guides/jmx/index.html</a></p>
<blockquote>
<p>Typical uses of the JMX technology include:
1. Consulting and changing application configuration
2. Accumulating statistics about application behavior and making them available
3. Notifying of state changes and erroneous conditions.</p>
</blockquote></pre>tv64738: <pre><p>Perhaps, but gmx ain't.</p></pre>titpetric: <pre><p>You can export pprof data to prometheus, so everything you need is already there, you just need to enable it. In fact Prometheus profiles itself with pprof, since it's written in Go.</p></pre>tex0: <pre><p>As far as I know the Prometheus Go client makes no use of pprof.</p></pre>Redundancy_: <pre><p>Have you looked at something like <a href="https://stackimpact.com/" rel="nofollow">https://stackimpact.com/</a> ?</p></pre>hollafi: <pre><p>Maybe check out expvar.</p></pre>hobbified: <pre><p>Do you need it for Java? Not as far as I can tell.</p></pre>wanghq: <pre><p>Sorry for the ambiguous description. I need a JMX like thing which works for Go so I can view and change my application stats.</p></pre>hobbified: <pre><p>Yes, and my point was that it's a lousy idea in Java, which makes it twice as lousy an idea in Go, because it doesn't even have the peer-pressure excuse. For viewing, you might want to use expvar, which is in the core and has integrations with some things. For changing configs... no, don't just casually do that. Don't even think about using a thing that makes it easy :)</p></pre>
