use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class GrpcActiveThreadDumpService method createActiveThreadDump.
private PActiveThreadDump createActiveThreadDump(ThreadDump threadDump) {
final ThreadInfo threadInfo = threadDump.getThreadInfo();
ThreadDumpMetricSnapshot threadDumpMetricSnapshot = ThreadDumpUtils.createThreadDump(threadInfo);
PThreadDump pThreadDump = grpcThreadDumpMessageConverter.toMessage(threadDumpMetricSnapshot);
final ActiveTraceSnapshot activeTraceInfo = threadDump.getActiveTraceSnapshot();
PActiveThreadDump.Builder builder = PActiveThreadDump.newBuilder();
builder.setStartTime(activeTraceInfo.getStartTime());
builder.setLocalTraceId(activeTraceInfo.getLocalTransactionId());
builder.setThreadDump(pThreadDump);
if (activeTraceInfo.isSampled()) {
builder.setSampled(true);
builder.setTransactionId(activeTraceInfo.getTransactionId());
builder.setEntryPoint(activeTraceInfo.getEntryPoint());
}
return builder.build();
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadDumpServiceTest method extractThreadNameList.
private List<String> extractThreadNameList(List<ActiveTraceSnapshot> activeTraceInfoList, int size) {
List<ActiveTraceSnapshot> copied = shuffle(activeTraceInfoList);
List<String> threadNameList = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
final ActiveTraceSnapshot activeTraceSnapshot = copied.get(i);
ThreadInfo thread = ThreadMXBeanUtils.getThreadInfo(activeTraceSnapshot.getThreadId());
threadNameList.add(thread.getThreadName());
}
return threadNameList;
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadDumpServiceTest method basicFunctionTest3.
@Test
public void basicFunctionTest3() {
List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, 1000 * 3);
int targetThreadNameSize = 3;
List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
List<String> threadNameList = extractThreadNameList(activeTraceInfoList, targetThreadNameSize);
TCmdActiveThreadDump tCmdActiveThreadDump = createRequest(0, threadNameList, null);
ActiveThreadDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadDumpRes response = (TCmdActiveThreadDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(3, response.getThreadDumpsSize());
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadDumpServiceTest method basicFunctionTest5.
@Test
public void basicFunctionTest5() {
List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, 1000 * 3);
List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
int limit = 3;
List<Long> oldTimeList = getOldTimeList(limit);
TCmdActiveThreadDump tCmdActiveThreadDump = createRequest(limit, null, null);
ActiveThreadDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadDumpRes response = (TCmdActiveThreadDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(limit, response.getThreadDumpsSize());
for (TActiveThreadDump dump : response.getThreadDumps()) {
Assert.assertTrue(oldTimeList.contains(dump.getStartTime()));
}
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class GrpcActiveThreadLightDumpService method createActiveThreadDump.
private PActiveThreadLightDump createActiveThreadDump(ThreadDump threadDump) {
final ActiveTraceSnapshot activeTraceInfo = threadDump.getActiveTraceSnapshot();
final ThreadInfo threadInfo = threadDump.getThreadInfo();
PThreadLightDump pThreadLightDump = createPThreadLightDump(threadInfo);
PActiveThreadLightDump.Builder builder = PActiveThreadLightDump.newBuilder();
builder.setStartTime(activeTraceInfo.getStartTime());
builder.setLocalTraceId(activeTraceInfo.getLocalTransactionId());
builder.setThreadDump(pThreadLightDump);
if (activeTraceInfo.isSampled()) {
builder.setSampled(true);
builder.setTransactionId(activeTraceInfo.getTransactionId());
builder.setEntryPoint(activeTraceInfo.getEntryPoint());
}
return builder.build();
}
Aggregations