use of com.creditease.uav.threadanalysis.server.ThreadAnalyser in project uavstack by uavorg.
the class ThreadAnalysisQueryHandler method queryMultiDumpInfo.
private void queryMultiDumpInfo(UAVHttpMessage data) {
String ipport = data.getRequest("ipport");
String timesStr = data.getRequest("times");
List<String> times = JSONHelper.toObjectArray(timesStr, String.class);
List<List<Map<String, Object>>> records = new ArrayList<>();
for (String time : times) {
long timestamp = DataConvertHelper.toLong(time, -1L);
// build query builder
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
queryBuilder.must(QueryBuilders.rangeQuery("time").gte(timestamp).lte(timestamp));
queryBuilder.must(QueryBuilders.termQuery("ipport", ipport));
SearchResponse sr = query(data, queryBuilder, null, buildSorts(data));
List<Map<String, Object>> record = getRecords(sr);
records.add(record);
}
ThreadAnalyser ta = (ThreadAnalyser) getConfigManager().getComponent(feature, "ThreadAnalyser");
List<Map<String, String>> rs = ta.queryMutilDumpInfo(times, records);
data.putResponse("rs", JSONHelper.toString(rs));
}
use of com.creditease.uav.threadanalysis.server.ThreadAnalyser in project uavstack by uavorg.
the class ThreadAnalysisQueryHandler method queryMultiDumpGraph.
private void queryMultiDumpGraph(UAVHttpMessage data) {
String ipport = data.getRequest("ipport");
String timesStr = data.getRequest("times");
String threadIdsStr = data.getRequest("threadIds");
List<String> times = JSONHelper.toObjectArray(timesStr, String.class);
List<String> threadIds = JSONHelper.toObjectArray(threadIdsStr, String.class);
List<List<Map<String, Object>>> records = new ArrayList<>();
for (String time : times) {
long timestamp = DataConvertHelper.toLong(time, -1L);
// build query builder
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
queryBuilder.must(QueryBuilders.rangeQuery("time").gte(timestamp).lte(timestamp));
queryBuilder.must(QueryBuilders.termQuery("ipport", ipport));
SearchResponse sr = query(data, queryBuilder, null, buildSorts(data));
List<Map<String, Object>> record = getRecords(sr);
records.add(record);
}
ThreadAnalyser ta = (ThreadAnalyser) getConfigManager().getComponent(feature, "ThreadAnalyser");
Map<String, Object> rs = ta.queryMutilDumpGraph(threadIds, records);
data.putResponse("rs", JSONHelper.toString(rs));
}
use of com.creditease.uav.threadanalysis.server.ThreadAnalyser in project uavstack by uavorg.
the class ThreadAnalysisQueryHandler method queryThreadDigraph.
/**
* @param data
* @return {nodes: [{id:0, name:'', type: '', state: ''}], edges: [{from:0, to:1}]}
*/
private void queryThreadDigraph(UAVHttpMessage data) {
QueryBuilder query = buildQuery(data);
if (query == null) {
return;
}
SearchResponse sr = query(data, query, null, buildSorts(data));
List<Map<String, Object>> records = getRecords(sr);
ThreadAnalyser ta = (ThreadAnalyser) getConfigManager().getComponent(feature, "ThreadAnalyser");
Map<String, Object> rs = ta.buildThreadDigraph(records);
data.putResponse("rs", JSONHelper.toString(rs));
}
use of com.creditease.uav.threadanalysis.server.ThreadAnalyser in project uavstack by uavorg.
the class ThreadAnalysisQueryHandler method queryDumpInfo.
/**
* @param data
* @return josnString: {cpu: '50', threadCount: '123', runnableCount: '23', blockedCount: '34', waitingCount: '45',
* deadlock: []}
*/
private void queryDumpInfo(UAVHttpMessage data) {
QueryBuilder query = buildQuery(data);
if (query == null) {
return;
}
SearchResponse sr = query(data, query, null, buildSorts(data));
List<Map<String, Object>> records = getRecords(sr);
ThreadAnalyser ta = (ThreadAnalyser) getConfigManager().getComponent(feature, "ThreadAnalyser");
Map<String, Object> map = ta.queryDumpInfo(records);
data.putResponse("rs", JSONHelper.toString(map));
}
use of com.creditease.uav.threadanalysis.server.ThreadAnalyser in project uavstack by uavorg.
the class ThreadAnalysisQueryHandler method queryThreadChain.
/**
* 查找线程依赖
*
* @param data
*/
private void queryThreadChain(UAVHttpMessage data) {
QueryBuilder query = buildQuery(data);
if (query == null) {
return;
}
SearchResponse sr = query(data, query, null, buildSorts(data));
List<Map<String, Object>> records = getRecords(sr);
String threadId = data.getRequest("threadId");
ThreadAnalyser ta = (ThreadAnalyser) getConfigManager().getComponent(feature, "ThreadAnalyser");
List<ThreadObject> chain = ta.findThreadChain(records, threadId);
List<String> infoChain = new ArrayList<>();
for (ThreadObject to : chain) {
infoChain.add(to.getInfo());
}
data.putResponse("rs", JSONHelper.toString(infoChain));
}
Aggregations