How can I get the current number of client request

2019-07-15 04:45发布

I'd like to get the current number of active client request threads in a spring boot app using embedded tomcat so that I can expose it over actuator's metrics endpoint. I'm not looking for active sessions, but active request processing threads. Preferably, I'd like to get this data per connector as well.

Does anyone have any ideas on a good way to get at this information in spring boot?

1条回答
祖国的老花朵
2楼-- · 2019-07-15 05:08

I don't know if this is what you are looking for, but you can get serveral values like that via JMX. You can start you current Spring Boot app and open Java Mission Control ([JDK directory]/bin). Open MBean browser and have a look at Tomcat->Thread Pool->[ConnectorName]:

MBean Browser

You can get those values programmatically, too.

查看更多
登录 后发表回答