use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.
the class AgentActiveThreadDumpFactory method create2.
public AgentActiveThreadDumpList create2(List<TActiveThreadLightDump> tActiveThreadLightDumpList) {
if (CollectionUtils.isEmpty(tActiveThreadLightDumpList)) {
return AgentActiveThreadDumpList.EMPTY_INSTANCE;
}
AgentActiveThreadDumpList result = new AgentActiveThreadDumpList(tActiveThreadLightDumpList.size());
for (TActiveThreadLightDump activeThreadLightDump : tActiveThreadLightDumpList) {
try {
AgentActiveThreadDump agentActiveThreadDump = create2(activeThreadLightDump);
result.add(agentActiveThreadDump);
} catch (Exception e) {
logger.warn("create AgentActiveThreadDump fail. arguments(TActiveThreadDump:{})", activeThreadLightDump);
}
}
return result;
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.
the class AgentActiveThreadDumpListTest method createThreadLightDumpList.
private AgentActiveThreadDumpList createThreadLightDumpList(Thread[] threads) {
List<TActiveThreadLightDump> activeThreadLightDumpList = new ArrayList<>();
for (Thread thread : threads) {
TActiveThreadLightDump tActiveThreadDump = new TActiveThreadLightDump();
tActiveThreadDump.setStartTime(System.currentTimeMillis() - ThreadLocalRandom.current().nextLong(100000));
tActiveThreadDump.setThreadDump(createTThreadLightDump(thread));
activeThreadLightDumpList.add(tActiveThreadDump);
}
AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
return factory.create2(activeThreadLightDumpList);
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.
the class ActiveThreadLightDumpService method requestCommandService.
@Override
public TBase<?, ?> requestCommandService(TBase tBase) {
TCmdActiveThreadLightDump request = (TCmdActiveThreadLightDump) tBase;
List<TActiveThreadLightDump> activeThreadDumpList = getActiveThreadDumpList(request);
TCmdActiveThreadLightDumpRes response = new TCmdActiveThreadLightDumpRes();
response.setType("JAVA");
response.setSubType(JvmUtils.getType().name());
response.setVersion(JvmUtils.getVersion().name());
response.setThreadDumps(activeThreadDumpList);
return response;
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.
the class ActiveThreadLightDumpService method getTActiveThreadDumpList.
private List<TActiveThreadLightDump> getTActiveThreadDumpList(TCmdActiveThreadLightDump request, int limit, List<ActiveTraceInfo> activeTraceInfoList) {
int targetThreadNameListSize = request.getThreadNameListSize();
int localTraceIdListSize = request.getLocalTraceIdListSize();
boolean filterEnable = (targetThreadNameListSize + localTraceIdListSize) > 0;
List<TActiveThreadLightDump> activeThreadDumpList = new ArrayList<TActiveThreadLightDump>(Math.min(limit, activeTraceInfoList.size()));
if (filterEnable) {
for (ActiveTraceInfo activeTraceInfo : activeTraceInfoList) {
if (!ActiveThreadDumpUtils.isTraceThread(activeTraceInfo, request.getThreadNameList(), request.getLocalTraceIdList())) {
continue;
}
TActiveThreadLightDump activeThreadDump = createActiveLightThreadDump(activeTraceInfo);
if (activeThreadDump != null) {
if (limit > activeThreadDumpList.size()) {
activeThreadDumpList.add(activeThreadDump);
}
}
}
} else {
for (ActiveTraceInfo activeTraceInfo : activeTraceInfoList) {
TActiveThreadLightDump activeThreadDump = createActiveLightThreadDump(activeTraceInfo);
if (activeThreadDump != null) {
if (limit > activeThreadDumpList.size()) {
activeThreadDumpList.add(activeThreadDump);
}
}
}
}
return activeThreadDumpList;
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.
the class ActiveThreadLightDumpServiceTest method basicFunctionTest5.
@Test
public void basicFunctionTest5() throws Exception {
List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, JOB_TIMEOUT);
List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
int limit = 3;
List<Long> oldTimeList = getOldTimeList(limit);
TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(limit, null, null);
ActiveThreadLightDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(limit, response.getThreadDumpsSize());
for (TActiveThreadLightDump dump : response.getThreadDumps()) {
Assert.assertTrue(oldTimeList.contains(dump.getStartTime()));
}
}
Aggregations