Getting no Jetty Metrics

222 views
Skip to first unread message

Gagan Singhal

unread,
Apr 27, 2022, 9:43:29 AM4/27/22
to Prometheus Users
I have configured the Jetty metrics in my code as mentioned in the prometheus client_java documentation. 
I can see the jetty metrics on the mentioned endpoint (/metrics) but they all show the value as 0. I don't know how to proceed further. Any help is appreciated.

Fabian Stäber

unread,
May 4, 2022, 10:39:28 AM5/4/22
to Prometheus Users
Hi Gagan,

Sorry for the late reply, your mail ended up in my Spam folder for some reason. Could you let me know which Jetty version you are using?

Fabian

On Wed, Apr 27, 2022 at 3:43 PM Gagan Singhal <gagansi...@gmail.com> wrote:
I have configured the Jetty metrics in my code as mentioned in the prometheus client_java documentation. 
I can see the jetty metrics on the mentioned endpoint (/metrics) but they all show the value as 0. I don't know how to proceed further. Any help is appreciated.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/a499c069-4c5d-475c-bb46-80813d7a07abn%40googlegroups.com.

Gagan Singhal

unread,
May 5, 2022, 3:38:53 AM5/5/22
to Prometheus Users
Hey, it's alright.

The custom instrumentation jetty metrics problem is solved. Thankyou.

Now I am trying to use auto instrumentation using jmx exporter to get the metrics to prometheus. 
My jetty is running through Tanuki Wrapper.
When i try to get the metrics by including the agent, I can see all the jvm metrics and jetty metrics. But for the jetty metrics, the values are stuck at 0.
I have included jmx and stats modules too.

Java version is Java 1.8
Jetty version is 9.4.26

Any help is appreciated, Thanks

Fabian Stäber

unread,
May 5, 2022, 10:37:22 AM5/5/22
to Prometheus Users
Hi Gagan,

if you already have custom instrumentation with client_java, there is no need to use the jmx_exporter. You can get standard JMX exports by just including the simpleclient_hotspot module as a dependency and then call DefaultExports.initialize().

Fabian


Gagan Singhal

unread,
May 5, 2022, 2:45:36 PM5/5/22
to Prometheus Users
Yes, I understand that but now I was trying to get the metrics through automatic instrumentation using the agent without any involvement of custom/manual instrumentation.

But, although I can see the JVM and jetty metrics at the port where the metrics are exposed, the value of all jetty metrics is shown to be 0. JVM metrics are working fine. All this is happening when I try to run jetty and agent through tanuki wrapper,

Note: I also tried the automatic instrumentation on the jetty server which wasn't using the tanuki wrapper and everything including jetty metrics seemed to be working fine. 

Fabian Stäber

unread,
May 5, 2022, 3:42:21 PM5/5/22
to Prometheus Users
Hi,

That sounds weird. The jmx_exporter forwards values coming from JMX. If you say that you see the metrics, but they have a value of 0, then I would assume the value 0 is actually coming from JMX.

Please attach a JMX tool like the MBean browser of Java Flight Recorder or the MBean browser of Java Mission Control to your JVM and see what value the JMX beans actually expose. That way you can see if the value of zero is actually coming from JMX, or if JMX attributes have a different value and the zero is coming from somewhere else.

Fabian

Gagan Singhal

unread,
May 6, 2022, 2:22:51 AM5/6/22
to Prometheus Users
Will try to do that, Thanks
Reply all
Reply to author
Forward
0 new messages