Search in sources :

Example 6 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 7 with ActiveTraceSnapshot

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

Example 8 with ActiveTraceSnapshot

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

Example 9 with ActiveTraceSnapshot

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

Example 10 with ActiveTraceSnapshot

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

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