问题
I have a simple Spring Boot web application set up for handling incoming http requests.
Using the Java VisualVm I am able to see MBeans such as Tomcat's internal Threadpool. See the following screenshot:
Screenshot of the Java VisualVM's MBean viewer
I have successfully used JMX to monitor attributes such as "currentThreadCount" and "currentThreadsBusy". I set up Prometheus to access the monitored attributes as well. This works well.
However, now I wanted to know if it is possible to access these values without using JMX? I noticed that the abstract class https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/tomcat/util/net/AbstractEndpoint.html contains a method called getCurrentThreadCount(). The class Nio2Endpoint (https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/tomcat/util/net/Nio2Endpoint.html) extends AbstractEndpoint. So I imagine that this might be a way to retrieve these values.
Unfortunately I am not able to access the endpoints in any way. Can anybody tell me if it is possible at all to access them without using JMX?
Thank you very much!
来源:https://stackoverflow.com/questions/48440800/monitor-tomcats-internal-threadpool-without-using-jmx-in-a-spring-boot-app