Search in sources :

Example 1 with PThreadDump

use of com.navercorp.pinpoint.grpc.trace.PThreadDump in project pinpoint by naver.

the class GrpcDeadlockBoMapper method map.

public DeadlockBo map(final PDeadlock deadlock) {
    final DeadlockBo deadlockBo = new DeadlockBo();
    deadlockBo.setDeadlockedThreadCount(deadlock.getCount());
    final List<PThreadDump> threadDumpList = deadlock.getThreadDumpList();
    if (CollectionUtils.hasLength(threadDumpList)) {
        final List<ThreadDumpBo> threadDumpBoList = new ArrayList<>();
        for (PThreadDump threadDump : threadDumpList) {
            final ThreadDumpBo threadDumpBo = this.threadDumpBoMapper.map(threadDump);
            threadDumpBoList.add(threadDumpBo);
        }
        deadlockBo.setThreadDumpBoList(threadDumpBoList);
    }
    return deadlockBo;
}
Also used : DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) ArrayList(java.util.ArrayList) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Example 2 with PThreadDump

use of com.navercorp.pinpoint.grpc.trace.PThreadDump 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 PThreadDump

use of com.navercorp.pinpoint.grpc.trace.PThreadDump in project pinpoint by naver.

the class GrpcStatMessageConverter method convertDeadlock.

private PDeadlock convertDeadlock(DeadlockMetricSnapshot deadlockMetricSnapshot) {
    // Only send id values that have already been sent
    final PDeadlock.Builder deadlockBuilder = PDeadlock.newBuilder();
    deadlockBuilder.setCount(deadlockMetricSnapshot.getDeadlockedThreadCount());
    for (ThreadDumpMetricSnapshot threadDumpMetricSnapshot : deadlockMetricSnapshot.getDeadlockedThreadList()) {
        final PThreadDump threadDump = this.threadDumpMessageConverter.toMessage(threadDumpMetricSnapshot);
        if (threadDump != null) {
            deadlockBuilder.addThreadDump(threadDump);
        }
    }
    return deadlockBuilder.build();
}
Also used : ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) PDeadlock(com.navercorp.pinpoint.grpc.trace.PDeadlock) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Example 4 with PThreadDump

use of com.navercorp.pinpoint.grpc.trace.PThreadDump in project pinpoint by naver.

the class GrpcThreadDumpMessageConverter method toMessage.

@Override
public PThreadDump toMessage(Object message) {
    if (message instanceof ThreadDumpMetricSnapshot) {
        final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = (ThreadDumpMetricSnapshot) message;
        final PThreadDump.Builder threadDumpBuilder = PThreadDump.newBuilder();
        threadDumpBuilder.setThreadName(threadDumpMetricSnapshot.getThreadName());
        threadDumpBuilder.setThreadId(threadDumpMetricSnapshot.getThreadId());
        threadDumpBuilder.setBlockedTime(threadDumpMetricSnapshot.getBlockedTime());
        threadDumpBuilder.setBlockedCount(threadDumpMetricSnapshot.getBlockedCount());
        threadDumpBuilder.setWaitedTime(threadDumpMetricSnapshot.getWaitedTime());
        threadDumpBuilder.setWaitedCount(threadDumpMetricSnapshot.getWaitedCount());
        threadDumpBuilder.setInNative(threadDumpMetricSnapshot.isInNative());
        threadDumpBuilder.setSuspended(threadDumpMetricSnapshot.isSuspended());
        final PThreadState threadState = this.threadStateMessageConverter.toMessage(threadDumpMetricSnapshot.getThreadState());
        threadDumpBuilder.setThreadState(threadState);
        for (String stackTrace : threadDumpMetricSnapshot.getStackTrace()) {
            threadDumpBuilder.addStackTrace(stackTrace);
        }
        for (MonitorInfoMetricSnapshot monitorInfoMetricSnapshot : threadDumpMetricSnapshot.getLockedMonitors()) {
            final PMonitorInfo.Builder monitorInfoBuilder = PMonitorInfo.newBuilder();
            monitorInfoBuilder.setStackDepth(monitorInfoMetricSnapshot.getStackDepth());
            monitorInfoBuilder.setStackFrame(monitorInfoMetricSnapshot.getStackFrame());
            threadDumpBuilder.addLockedMonitor(monitorInfoBuilder.build());
        }
        if (threadDumpMetricSnapshot.getLockName() != null) {
            threadDumpBuilder.setLockName(threadDumpMetricSnapshot.getLockName());
        }
        threadDumpBuilder.setLockOwnerId(threadDumpMetricSnapshot.getLockOwnerId());
        if (threadDumpMetricSnapshot.getLockOwnerName() != null) {
            threadDumpBuilder.setLockOwnerName(threadDumpMetricSnapshot.getLockOwnerName());
        }
        for (String lockedSynchronizer : threadDumpMetricSnapshot.getLockedSynchronizers()) {
            threadDumpBuilder.addLockedSynchronizer(lockedSynchronizer);
        }
        return threadDumpBuilder.build();
    } else {
        return null;
    }
}
Also used : MonitorInfoMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot) PMonitorInfo(com.navercorp.pinpoint.grpc.trace.PMonitorInfo) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) PThreadState(com.navercorp.pinpoint.grpc.trace.PThreadState) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Aggregations

PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)4 ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)3 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)1 ThreadDumpBo (com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)1 PActiveThreadDump (com.navercorp.pinpoint.grpc.trace.PActiveThreadDump)1 PDeadlock (com.navercorp.pinpoint.grpc.trace.PDeadlock)1 PMonitorInfo (com.navercorp.pinpoint.grpc.trace.PMonitorInfo)1 PThreadState (com.navercorp.pinpoint.grpc.trace.PThreadState)1 ActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)1 MonitorInfoMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot)1 ThreadInfo (java.lang.management.ThreadInfo)1 ArrayList (java.util.ArrayList)1