Expose java metrics to prometheus

59 views
Skip to first unread message

Nidhi Sharma

unread,
May 19, 2020, 2:32:10 AM5/19/20
to Prometheus Users
Hi, I have a web app running on tomcat. There is a hello resource (REST API) to check the health of the app. Output if this resource gives the version of the app. I want output of this resource to be captured as a metric and pulled by Prometheus. Please help on how can I proceed.  

Vu Tuan Dat

unread,
May 19, 2020, 4:39:51 AM5/19/20
to Prometheus Users

Nidhi Sharma

unread,
May 19, 2020, 5:17:00 AM5/19/20
to Prometheus Users
Thanks for replying. Can we do this by Mbeans and JMX ? I can create Mbeans and register it in my application but I dont know how to capture the output in Prometheus time series format. For ex : Product_version{product="SomeProduct",version="2.9.1"}

Vu Tuan Dat

unread,
May 19, 2020, 5:33:30 AM5/19/20
to Prometheus Users
Create a metric name as you wanted and add labels to it https://github.com/prometheus/client_java#labels
Reply all
Reply to author
Forward
0 new messages