use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadDumpService method createTActiveThreadDump.
private TActiveThreadDump createTActiveThreadDump(ThreadDump threadDump) {
final ActiveTraceSnapshot activeTraceInfo = threadDump.getActiveTraceSnapshot();
final ThreadInfo threadInfo = threadDump.getThreadInfo();
final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = ThreadDumpUtils.createThreadDump(threadInfo);
final TThreadDump tThreadDump = this.threadDumpThriftMessageConverter.toMessage(threadDumpMetricSnapshot);
TActiveThreadDump activeThreadDump = new TActiveThreadDump();
activeThreadDump.setStartTime(activeTraceInfo.getStartTime());
activeThreadDump.setLocalTraceId(activeTraceInfo.getLocalTransactionId());
activeThreadDump.setThreadDump(tThreadDump);
if (activeTraceInfo.isSampled()) {
activeThreadDump.setSampled(true);
activeThreadDump.setTransactionId(activeTraceInfo.getTransactionId());
activeThreadDump.setEntryPoint(activeTraceInfo.getEntryPoint());
}
return activeThreadDump;
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadDumpCoreService method filterActiveThreadDump.
private Collection<ThreadDump> filterActiveThreadDump(List<ActiveTraceSnapshot> activeTraceInfoList, ThreadDumpRequest request) {
final Collection<ThreadDump> result = new LimitedList<ThreadDump>(request.getLimit(), reverseOrder);
for (ActiveTraceSnapshot activeTraceInfo : activeTraceInfoList) {
final long threadId = activeTraceInfo.getThreadId();
if (!isTraceThread(threadId)) {
continue;
}
final ThreadDump threadDump = filter(activeTraceInfo, request);
if (threadDump != null) {
result.add(threadDump);
}
}
return result;
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadLightDumpServiceTest method basicFunctionTest1.
@Test
public void basicFunctionTest1() 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);
ActiveThreadLightDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(createRequest(0, null, null));
Assert.assertEquals(CREATE_SIZE, response.getThreadDumpsSize());
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadLightDumpServiceTest method basicFunctionTest2.
@Test
public void basicFunctionTest2() 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);
TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(0, null, Arrays.asList(1L));
ActiveThreadLightDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(1, response.getThreadDumpsSize());
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadLightDumpServiceTest method basicFunctionTest3.
@Test
public void basicFunctionTest3() throws Exception {
List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, JOB_TIMEOUT);
int targetThreadNameSize = 3;
List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
List<String> threadNameList = extractThreadNameList(activeTraceInfoList, targetThreadNameSize);
TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(0, threadNameList, null);
ActiveThreadLightDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(3, response.getThreadDumpsSize());
}
Aggregations