alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.76k stars 8.55k forks source link

Expose com.alibaba.druid.stat.JdbcStatManager as MBean #2276

Open ralf0131 opened 6 years ago

ralf0131 commented 6 years ago

In order to get the druid stats [1] for monitoring, I found that it is impossible to get such data via JMX. My local application depends on druid 1.0.25, after bootstrapping my application and execute some query to database, I opened up JConsole and could not found any MBean represents com.alibaba.druid.stat.JdbcStatManager.

The only way I could found is to call com.alibaba.druid.stat.JdbcStatManager#getInstance() reflectively to get the reference, which seems not very elegant.

It will be very appreciated to expose com.alibaba.druid.stat.JdbcStatManager as MBean so that external program could access via JMX directly.

[1] https://github.com/alibaba/druid/wiki/StatFilter_Items

chanjarster commented 5 years ago

@wenshao Any progress on this issue?

Expose JdbcStatManager as MBean is a very useful feature. As long as implemented, one can easily use jmx-exporter to gather stats information from a cluster environment to prometheus.

majintao commented 5 years ago

这问题,还没结单。。。 我也有同样的需求