mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add stat service
This commit is contained in:
@@ -109,7 +109,7 @@ public class JdbcDataSourceStat implements JdbcDataSourceStatMBean {
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry<String, JdbcSqlStat> entry = iter.next();
|
||||
JdbcSqlStat stat = entry.getValue();
|
||||
if (stat.getExecuteCount() == 0) {
|
||||
if (stat.getExecuteCount() == 0 && stat.getRunningCount() == 0) {
|
||||
iter.remove();
|
||||
} else {
|
||||
stat.reset();
|
||||
|
||||
@@ -301,7 +301,7 @@ public class JdbcStatManager implements JdbcStatManagerMBean {
|
||||
for (DataSourceProxyImpl dataSource : DruidDriver.getProxyDataSources().values()) {
|
||||
Map<String, JdbcSqlStat> statMap = dataSource.getDataSourceStat().getSqlStatMap();
|
||||
for (Map.Entry<String, JdbcSqlStat> entry : statMap.entrySet()) {
|
||||
if (entry.getValue().getExecuteCount() == 0) {
|
||||
if (entry.getValue().getExecuteCount() == 0 && entry.getValue().getRunningCount() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public class JdbcStatManager implements JdbcStatManagerMBean {
|
||||
for (DruidDataSource dataSource : DruidDataSourceStatManager.getDruidDataSourceInstances()) {
|
||||
Map<String, JdbcSqlStat> statMap = dataSource.getDataSourceStat().getSqlStatMap();
|
||||
for (Map.Entry<String, JdbcSqlStat> entry : statMap.entrySet()) {
|
||||
if (entry.getValue().getExecuteCount() == 0) {
|
||||
if (entry.getValue().getExecuteCount() == 0 && entry.getValue().getRunningCount() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -339,6 +339,10 @@ public class StatViewServlet extends HttpServlet {
|
||||
List<Map<String, Object>> array = new ArrayList<Map<String, Object>>();
|
||||
for (DruidDataSource datasource : DruidDataSourceStatManager.getDruidDataSourceInstances()) {
|
||||
for (JdbcSqlStat sqlStat : datasource.getDataSourceStat().getSqlStatMap().values()) {
|
||||
if (sqlStat.getExecuteCount() == 0 && sqlStat.getRunningCount() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array.add(getSqlStatData(sqlStat));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user