use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadLightDumpService method createActiveThreadDump.
private TActiveThreadLightDump createActiveThreadDump(ThreadDump threadDump) {
final ActiveTraceSnapshot activeTraceInfo = threadDump.getActiveTraceSnapshot();
final ThreadInfo threadInfo = threadDump.getThreadInfo();
TThreadLightDump tThreadLightDump = createTThreadLightDump(threadInfo);
TActiveThreadLightDump activeThreadDump = new TActiveThreadLightDump();
activeThreadDump.setStartTime(activeTraceInfo.getStartTime());
activeThreadDump.setLocalTraceId(activeTraceInfo.getLocalTransactionId());
activeThreadDump.setThreadDump(tThreadLightDump);
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 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 ActiveThreadDumpCoreService method getAllActiveThreadDump.
private Collection<ThreadDump> getAllActiveThreadDump(List<ActiveTraceSnapshot> activeTraceInfoList, ThreadDumpRequest request) {
Collection<ThreadDump> activeThreadDumpList = new LimitedList<ThreadDump>(request.getLimit(), reverseOrder);
for (ActiveTraceSnapshot activeTraceInfo : activeTraceInfoList) {
final long threadId = activeTraceInfo.getThreadId();
if (!isTraceThread(threadId)) {
continue;
}
final ThreadInfo threadInfo = getThreadInfo(threadId, request.getStackTrace());
if (threadInfo != null) {
ThreadDump threadDump = newThreadDump(activeTraceInfo, threadInfo);
activeThreadDumpList.add(threadDump);
}
}
return activeThreadDumpList;
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class LimitedListTest method newTestData.
private List<ThreadDump> newTestData(int localTransactionId, long startTime, long threadId, int size) {
List<ThreadDump> result = new ArrayList<ThreadDump>();
for (int i = 0; i < size; i++) {
ActiveTraceSnapshot activeTraceSnapshot = new UnsampledActiveTraceSnapshot(localTransactionId, startTime, threadId);
ThreadInfo threadInfo = mock(ThreadInfo.class);
ThreadDump threadDump = new ThreadDump(activeTraceSnapshot, threadInfo);
threadId++;
localTransactionId++;
startTime++;
result.add(threadDump);
}
for (ThreadDump threadDump : result) {
logger.debug("newTestData:{}", threadDump);
}
Collections.shuffle(result);
return result;
}
use of com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot in project pinpoint by naver.
the class ActiveThreadLightDumpServiceTest method basicFunctionTest4.
@Test
public void basicFunctionTest4() 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);
List<ActiveTraceSnapshot> activeTraceSnapshotList = shuffle(activeTraceInfoList);
int targetThreadNameSize = 3;
List<String> threadNameList = extractThreadNameList(activeTraceSnapshotList.subList(0, targetThreadNameSize), targetThreadNameSize);
int targetTraceIdSize = 3;
List<Long> localTraceIdList = extractLocalTraceIdList(activeTraceSnapshotList.subList(targetThreadNameSize, CREATE_SIZE), targetTraceIdSize);
TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(0, threadNameList, localTraceIdList);
ActiveThreadLightDumpService service = createService(activeTraceInfoList);
TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
Assert.assertEquals(targetThreadNameSize + targetTraceIdSize, response.getThreadDumpsSize());
}
Aggregations