Search in sources :

Example 1 with ActiveTraceSnapshot

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;
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TThreadLightDump) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)

Example 2 with ActiveTraceSnapshot

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();
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) PActiveThreadDump(com.navercorp.pinpoint.grpc.trace.PActiveThreadDump) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Example 3 with ActiveTraceSnapshot

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;
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)

Example 4 with ActiveTraceSnapshot

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;
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) ArrayList(java.util.ArrayList) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot)

Example 5 with ActiveTraceSnapshot

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());
}
Also used : TCmdActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump) TCmdActiveThreadLightDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) Test(org.junit.Test)

Aggregations

ActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)21 UnsampledActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot)15 Test (org.junit.Test)10 ThreadInfo (java.lang.management.ThreadInfo)8 TCmdActiveThreadDumpRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDumpRes)5 TCmdActiveThreadLightDumpRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes)5 ArrayList (java.util.ArrayList)5 TCmdActiveThreadDump (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadDump)4 TCmdActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump)4 ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)2 TActiveThreadDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump)2 TActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)2 PActiveThreadDump (com.navercorp.pinpoint.grpc.trace.PActiveThreadDump)1 PActiveThreadLightDump (com.navercorp.pinpoint.grpc.trace.PActiveThreadLightDump)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 PThreadLightDump (com.navercorp.pinpoint.grpc.trace.PThreadLightDump)1 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)1 TThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TThreadLightDump)1