Search in sources :

Example 11 with ActiveTraceSnapshot

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;
}
Also used : ThreadInfo(java.lang.management.ThreadInfo) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TActiveThreadDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump)

Example 12 with ActiveTraceSnapshot

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

Example 13 with ActiveTraceSnapshot

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());
}
Also used : 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)

Example 14 with ActiveTraceSnapshot

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());
}
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)

Example 15 with ActiveTraceSnapshot

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());
}
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