[Hawkular-dev] jmx exporter - com.sun classes used

Paul Gier pgier at redhat.com
Thu Nov 16 10:46:34 EST 2017


On 10/27/2017 09:56 AM, John Mazzitelli wrote:
>> I think the com.sun.* classes will work with OpenJDK (at least the JMX
>> exporter works fine when using OpenJDK)
>>
>> As to whether it will work with other JVMs is another question. Is this
>> part of the code we are forking anyways? I assume since we need to make
>> other modifications here to support https, we might as well update this
>> section as well.
> 
> 
> We are using it in our forked class here:
> 
> https://github.com/jmazzitelli/hawkular-agent/blob/remove-h-metrics/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/prometheus/WebServer.java#L47
> 
> Unfortunately, the way they coded up this class, it can't be subclasses and overridden. We'd have to write our own and integrate the jmx exporter stuff ourselves. Means we'll be writing a bit more code, but, yeah, once we start implementing the https stuff, we can do it all at once.
> 
> 

I checked that the com.sun httpserver classes are available in both
openjdk and in the IBM JDK.  These classes are also exported in a JDK 9
module [1].  So IMO it's probably ok for us to use the prometheus
webserver class as is.

[1]https://docs.oracle.com/javase/9/docs/api/jdk.httpserver-summary.html

> 
>>
>> On Fri, Oct 27, 2017 at 4:26 AM, Heiko Rupp <hrupp at redhat.com> wrote:
>>
>>> That package is indeed problematic. And may be even more so in the future
>>> on JDK9+ with the module system, where modules like this may be totally
>>> encapsulated away.
>>>
>>> On Fri, Oct 27, 2017 at 5:07 AM, John Mazzitelli <mazz at redhat.com> wrote:
>>>
>>>> Take a look at Prometheus's HTTPServer class:
>>>>
>>>> https://github.com/prometheus/client_java/blob/master/simple
>>>> client_httpserver/src/main/java/io/prometheus/client/
>>>> exporter/HTTPServer.java#L22-L24
>>>>
>>>> This Prometheus HTTPServer class is what jmx exporter uses for its
>>>> metrics endpoint - see:
>>>>
>>>> https://github.com/prometheus/jmx_exporter/blob/master/jmx_p
>>>> rometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java#L8
>>>> https://github.com/prometheus/jmx_exporter/blob/master/jmx_p
>>>> rometheus_httpserver/src/main/java/io/prometheus/jmx/WebServer.java#L7
>>>>
>>>> Since it uses com.sun.net.httpserver classes under the covers, I'll
>>>> assume this rules out support for, say, IBM's JVM (does IBM's JRE
>>>> implement
>>>> these?). I think this is available on OpenJDK but didn't check to make
>>>> 100%
>>>> sure.
>>>> _______________________________________________
>>>> hawkular-dev mailing list
>>>> hawkular-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/hawkular-dev
>>>>
>>>
>>>
>>>
>>> --
>>> Reg. Adresse: Red Hat GmbH, Technopark II, Haus C,
>>> Werner-von-Siemens-Ring 14, D-85630 Grasbrunn
>>> Handelsregister: Amtsgericht München HRB 153243
>>> Geschäftsführer: Charles Cachera, Michael Cunningham, Michael O'Neill,
>>> Eric Shander
>>>
>>> _______________________________________________
>>> hawkular-dev mailing list
>>> hawkular-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hawkular-dev
>>>
>>>
>>
> 
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev
> 


More information about the hawkular-dev mailing list