use of javax.management.openmbean.CompositeType in project druid by alibaba.
the class DruidDataSourceStatManager method getCompositeData.
public CompositeDataSupport getCompositeData(Object dataSource) throws JMException {
CompositeType rowType = getDruidDataSourceCompositeType();
Map<String, Object> map = DruidDataSourceUtils.getStatDataForMBean(dataSource);
return new CompositeDataSupport(rowType, map);
}
use of javax.management.openmbean.CompositeType in project druid by alibaba.
the class JdbcDataSourceStat method getConnectionList.
@Override
public TabularData getConnectionList() throws JMException {
CompositeType rowType = JdbcConnectionStat.Entry.getCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("ConnectionListStatistic", "ConnectionListStatistic", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : getConnections().entrySet()) {
data.put(entry.getValue().getCompositeData());
}
return data;
}
use of javax.management.openmbean.CompositeType in project druid by alibaba.
the class JdbcDataSourceStat method getSqlList.
@Override
public TabularData getSqlList() throws JMException {
Map<String, JdbcSqlStat> sqlStatMap = this.getSqlStatMap();
CompositeType rowType = JdbcSqlStat.getCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("SqlListStatistic", "SqlListStatistic", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
for (Map.Entry<String, JdbcSqlStat> entry : sqlStatMap.entrySet()) {
data.put(entry.getValue().getCompositeData());
}
return data;
}
use of javax.management.openmbean.CompositeType in project druid by alibaba.
the class JdbcSqlStat method getCompositeType.
public static CompositeType getCompositeType() throws JMException {
if (COMPOSITE_TYPE != null) {
return COMPOSITE_TYPE;
}
OpenType<?>[] indexTypes = new OpenType<?>[] { //
SimpleType.LONG, //
SimpleType.STRING, //
SimpleType.STRING, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.DATE, //
SimpleType.LONG, //
JMXUtils.getThrowableCompositeType(), //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.DATE, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.STRING, //
SimpleType.STRING, //
SimpleType.STRING, //
SimpleType.STRING, //
SimpleType.STRING, //
SimpleType.DATE, //
SimpleType.STRING, //
SimpleType.LONG, //
SimpleType.STRING, //
new ArrayType<Long>(SimpleType.LONG, true), //
SimpleType.STRING, //
SimpleType.LONG, //
SimpleType.LONG, //
new ArrayType<Long>(SimpleType.LONG, true), //
new ArrayType<Long>(SimpleType.LONG, true), //
new ArrayType<Long>(SimpleType.LONG, true), //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG, //
SimpleType.LONG };
String[] indexNames = { //
"ID", //
"DataSource", //
"SQL", //
"ExecuteCount", //
"ErrorCount", //
"TotalTime", //
"LastTime", //
"MaxTimespan", //
"LastError", //
"EffectedRowCount", //
"FetchRowCount", //
"MaxTimespanOccurTime", //
"BatchSizeMax", //
"BatchSizeTotal", //
"ConcurrentMax", //
"RunningCount", //
"Name", //
"File", //
"LastErrorMessage", //
"LastErrorClass", //
"LastErrorStackTrace", //
"LastErrorTime", //
"DbType", //
"InTransactionCount", //
"URL", //
"Histogram", //
"LastSlowParameters", //
"ResultSetHoldTime", //
"ExecuteAndResultSetHoldTime", //
"FetchRowCountHistogram", //
"EffectedRowCountHistogram", //
"ExecuteAndResultHoldTimeHistogram", //
"EffectedRowCountMax", //
"FetchRowCountMax", "ClobOpenCount", //
"BlobOpenCount", //
"ReadStringLength", //
"ReadBytesLength", //
"InputStreamOpenCount", //
"ReaderOpenCount", //
"HASH" };
String[] indexDescriptions = indexNames;
COMPOSITE_TYPE = new CompositeType("SqlStatistic", "Sql Statistic", indexNames, indexDescriptions, indexTypes);
return COMPOSITE_TYPE;
}
use of javax.management.openmbean.CompositeType in project druid by alibaba.
the class JdbcStatManager method getDataSourceList.
@Override
public TabularData getDataSourceList() throws JMException {
CompositeType rowType = getDataSourceCompositeType();
String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
TabularType tabularType = new TabularType("DataSourceStat", "DataSourceStat", rowType, indexNames);
TabularData data = new TabularDataSupport(tabularType);
{
final ConcurrentMap<String, DataSourceProxyImpl> dataSources = DruidDriver.getProxyDataSources();
for (DataSourceProxyImpl dataSource : dataSources.values()) {
data.put(dataSource.getCompositeData());
}
}
final Set<DruidDataSource> dataSources = DruidDataSourceStatManager.getDruidDataSourceInstances();
for (DruidDataSource dataSource : dataSources) {
data.put(dataSource.getCompositeData());
}
return data;
}
Aggregations