mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed & improve monitor-client
This commit is contained in:
@@ -22,10 +22,10 @@ import com.alibaba.druid.stat.JdbcSqlStatValue;
|
||||
import com.alibaba.druid.support.monitor.MField;
|
||||
import com.alibaba.druid.support.monitor.MTable;
|
||||
|
||||
@MTable(name="druid_datasource")
|
||||
@MTable(name = "druid_datasource")
|
||||
public class DruidDataSourceStatValue {
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
protected String name;
|
||||
|
||||
@MField
|
||||
@@ -34,7 +34,6 @@ public class DruidDataSourceStatValue {
|
||||
@MField
|
||||
protected String driverClassName;
|
||||
|
||||
@MField
|
||||
protected String url;
|
||||
protected String userName;
|
||||
protected List<String> filterClassNames;
|
||||
@@ -123,8 +122,7 @@ public class DruidDataSourceStatValue {
|
||||
|
||||
@MField
|
||||
protected long blobOpenCount;
|
||||
|
||||
|
||||
|
||||
protected long sqlSkipCount;
|
||||
|
||||
protected List<JdbcSqlStatValue> sqlList;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class JdbcSqlStatValue {
|
||||
|
||||
protected String sql;
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
private long sqlHash;
|
||||
|
||||
@MField
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.alibaba.druid.support.monitor.MTable;
|
||||
@MTable(name = "druid_webapp")
|
||||
public class WebAppStatValue {
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
String contextPath;
|
||||
|
||||
@MField
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.alibaba.druid.support.profile.ProfileEntryStatValue;
|
||||
@MTable(name = "druid_weburi")
|
||||
public class WebURIStatValue {
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
protected String uri;
|
||||
|
||||
@MField
|
||||
|
||||
@@ -25,4 +25,6 @@ import java.lang.annotation.Target;
|
||||
public @interface MField {
|
||||
|
||||
String name() default "";
|
||||
|
||||
boolean groupBy() default false;
|
||||
}
|
||||
|
||||
@@ -328,8 +328,10 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setParameterForSqlStat(BeanInfo beanInfo, MonitorContext ctx, PreparedStatement stmt, Object sqlStat)
|
||||
throws SQLException {
|
||||
protected void setParameterForSqlStat(BeanInfo beanInfo, //
|
||||
MonitorContext ctx, //
|
||||
PreparedStatement stmt, //
|
||||
Object sqlStat) throws SQLException {
|
||||
int paramIndex = 1;
|
||||
|
||||
setParam(stmt, paramIndex++, ctx.getDomainName());
|
||||
@@ -449,7 +451,8 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
|
||||
public static class BeanInfo {
|
||||
|
||||
private final Class<?> clazz;
|
||||
private final List<FieldInfo> fields = new ArrayList<FieldInfo>();
|
||||
private final List<FieldInfo> fields = new ArrayList<FieldInfo>();
|
||||
private final List<FieldInfo> groupByFields = new ArrayList<FieldInfo>();
|
||||
private String insertSql;
|
||||
private String tableName;
|
||||
|
||||
@@ -476,7 +479,11 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
|
||||
columnName = field.getName();
|
||||
}
|
||||
|
||||
fields.add(new FieldInfo(field, columnName));
|
||||
FieldInfo fieldInfo = new FieldInfo(field, columnName);
|
||||
fields.add(fieldInfo);
|
||||
if (annotation.groupBy()) {
|
||||
groupByFields.add(fieldInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,6 +507,10 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public List<FieldInfo> getGroupByFields() {
|
||||
return groupByFields;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class FieldInfo {
|
||||
@@ -529,6 +540,6 @@ public class MonitorDaoJdbcImpl implements MonitorDao {
|
||||
|
||||
@Override
|
||||
public void saveSqlWall(MonitorContext ctx, List<WallProviderStatValue> statList) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ import com.alibaba.druid.util.Utils;
|
||||
@MTable(name = "druid_springmethod")
|
||||
public class SpringMethodStatValue {
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
private String className;
|
||||
|
||||
@MField
|
||||
@MField(groupBy = true)
|
||||
private String signature;
|
||||
|
||||
@MField
|
||||
|
||||
Reference in New Issue
Block a user