mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
增强监控
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@335 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -305,7 +305,7 @@ public class DataSourceProxyImpl implements DataSourceProxy, DataSourceProxyImpl
|
||||
map.put("ResultSetLastOpenTime", stat.getResultSetStat().getLastOpenTime());
|
||||
|
||||
map.put("ResultSetErrorCount", stat.getResultSetStat().getErrorCount());
|
||||
map.put("ResultSetOpenningMillisTotal", stat.getResultSetStat().getOpenningMillisTotal());
|
||||
map.put("ResultSetOpenningMillisTotal", stat.getResultSetStat().getAliveMillisTotal());
|
||||
map.put("ResultSetLastErrorTime", stat.getResultSetStat().getLastErrorTime());
|
||||
Throwable lastResultSetError = stat.getResultSetStat().getLastError();
|
||||
if (lastResultSetError != null) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class JdbcResultSetStat implements JdbcResultSetStatMBean {
|
||||
private final AtomicLong openCount = new AtomicLong();
|
||||
private final AtomicLong errorCount = new AtomicLong();
|
||||
|
||||
private final AtomicLong openningNanoTotal = new AtomicLong();
|
||||
private final AtomicLong aliveNanoTotal = new AtomicLong();
|
||||
private Throwable lastError;
|
||||
private long lastErrorTime;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class JdbcResultSetStat implements JdbcResultSetStatMBean {
|
||||
opeeningtMax.set(0);
|
||||
openCount.set(0);
|
||||
errorCount.set(0);
|
||||
openningNanoTotal.set(0);
|
||||
aliveNanoTotal.set(0);
|
||||
lastError = null;
|
||||
lastErrorTime = 0;
|
||||
lastOpenTime = 0;
|
||||
@@ -92,18 +92,18 @@ public class JdbcResultSetStat implements JdbcResultSetStatMBean {
|
||||
return new Date(lastOpenTime);
|
||||
}
|
||||
|
||||
public long getOpenningNanoTotal() {
|
||||
return openningNanoTotal.get();
|
||||
public long getAliveNanoTotal() {
|
||||
return aliveNanoTotal.get();
|
||||
}
|
||||
|
||||
public long getOpenningMillisTotal() {
|
||||
return openningNanoTotal.get() / (1000 * 1000);
|
||||
public long getAliveMillisTotal() {
|
||||
return aliveNanoTotal.get() / (1000 * 1000);
|
||||
}
|
||||
|
||||
public void afterClose(long nanoSpan) {
|
||||
openningCount.decrementAndGet();
|
||||
|
||||
openningNanoTotal.addAndGet(nanoSpan);
|
||||
aliveNanoTotal.addAndGet(nanoSpan);
|
||||
}
|
||||
|
||||
public Throwable getLastError() {
|
||||
@@ -126,7 +126,7 @@ public class JdbcResultSetStat implements JdbcResultSetStatMBean {
|
||||
|
||||
@Override
|
||||
public long getHoldMillisTotal() {
|
||||
return JdbcStatManager.getInstance().getResultSetStat().getOpenningNanoTotal() / (1000 * 1000);
|
||||
return JdbcStatManager.getInstance().getResultSetStat().getAliveNanoTotal() / (1000 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user