Search in sources :

Example 1 with ThreadDumpMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by naver.

the class ThreadDumpUtils method createThreadDump.

public static ThreadDumpMetricSnapshot createThreadDump(ThreadInfo threadInfo) {
    final ThreadDumpMetricSnapshot threadDump = new ThreadDumpMetricSnapshot();
    setThreadInfo(threadDump, threadInfo);
    setThreadStatus(threadDump, threadInfo);
    setStackTrace(threadDump, threadInfo);
    setMonitorInfo(threadDump, threadInfo);
    setLockInfo(threadDump, threadInfo);
    return threadDump;
}
Also used : ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)

Example 2 with ThreadDumpMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot 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 ThreadDumpMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by naver.

the class DefaultDeadlockMetricCollector method collect.

@Override
public DeadlockMetricSnapshot collect() {
    Set<Long> deadlockedThreadIdSet = deadlockMetric.deadlockedThreadsIdSet();
    if (CollectionUtils.isEmpty(deadlockedThreadIdSet)) {
        return null;
    }
    // Only send id values that have already been sent
    if (prevDeadlockedThreadIdSet.containsAll(deadlockedThreadIdSet)) {
        DeadlockMetricSnapshot deadlock = new DeadlockMetricSnapshot();
        deadlock.setDeadlockedThreadCount(deadlockedThreadIdSet.size());
        return deadlock;
    }
    // The first event sends id and threadinfo
    final DeadlockMetricSnapshot deadlockMetricSnapshot = new DeadlockMetricSnapshot();
    deadlockMetricSnapshot.setDeadlockedThreadCount(deadlockedThreadIdSet.size());
    for (Long deadlockedThreadId : deadlockedThreadIdSet) {
        final ThreadDumpMetricSnapshot tThreadDump = ThreadDumpUtils.createTThreadDump(deadlockedThreadId);
        deadlockMetricSnapshot.addDeadlockedThread(tThreadDump);
        prevDeadlockedThreadIdSet = deadlockedThreadIdSet;
    }
    return deadlockMetricSnapshot;
}
Also used : ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot) DeadlockMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.DeadlockMetricSnapshot)

Example 4 with ThreadDumpMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by naver.

the class StatThriftMessageConverter method convertDeadlock.

private TDeadlock convertDeadlock(DeadlockMetricSnapshot deadlockMetricSnapshot) {
    // Only send id values that have already been sent
    final TDeadlock deadlock = new TDeadlock();
    deadlock.setDeadlockedThreadCount(deadlockMetricSnapshot.getDeadlockedThreadCount());
    for (ThreadDumpMetricSnapshot threadDumpMetricSnapshot : deadlockMetricSnapshot.getDeadlockedThreadList()) {
        final TThreadDump threadDump = this.threadDumpMessageConverter.toMessage(threadDumpMetricSnapshot);
        if (threadDump != null) {
            deadlock.addToDeadlockedThreadList(threadDump);
        }
    }
    return deadlock;
}
Also used : TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)

Example 5 with ThreadDumpMetricSnapshot

use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by naver.

the class ThreadDumpThriftMessageConverter method toMessage.

@Override
public TThreadDump toMessage(Object message) {
    if (message instanceof ThreadDumpMetricSnapshot) {
        final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = (ThreadDumpMetricSnapshot) message;
        final TThreadDump threadDump = new TThreadDump();
        threadDump.setThreadName(threadDumpMetricSnapshot.getThreadName());
        threadDump.setThreadId(threadDumpMetricSnapshot.getThreadId());
        threadDump.setBlockedTime(threadDumpMetricSnapshot.getBlockedTime());
        threadDump.setBlockedCount(threadDumpMetricSnapshot.getBlockedCount());
        threadDump.setWaitedTime(threadDumpMetricSnapshot.getWaitedTime());
        threadDump.setWaitedCount(threadDumpMetricSnapshot.getWaitedCount());
        threadDump.setInNative(threadDumpMetricSnapshot.isInNative());
        threadDump.setSuspended(threadDumpMetricSnapshot.isSuspended());
        final TThreadState threadState = this.threadStateMessageConverter.toMessage(threadDumpMetricSnapshot.getThreadState());
        threadDump.setThreadState(threadState);
        for (String stackTrace : threadDumpMetricSnapshot.getStackTrace()) {
            threadDump.addToStackTrace(stackTrace);
        }
        for (MonitorInfoMetricSnapshot monitorInfoMetricSnapshot : threadDumpMetricSnapshot.getLockedMonitors()) {
            final TMonitorInfo tMonitorInfo = new TMonitorInfo();
            tMonitorInfo.setStackDepth(monitorInfoMetricSnapshot.getStackDepth());
            tMonitorInfo.setStackFrame(monitorInfoMetricSnapshot.getStackFrame());
            threadDump.addToLockedMonitors(tMonitorInfo);
        }
        threadDump.setLockName(threadDumpMetricSnapshot.getLockName());
        threadDump.setLockOwnerId(threadDumpMetricSnapshot.getLockOwnerId());
        threadDump.setLockOwnerName(threadDumpMetricSnapshot.getLockOwnerName());
        for (String lockedSynchronizer : threadDumpMetricSnapshot.getLockedSynchronizers()) {
            threadDump.addToLockedSynchronizers(lockedSynchronizer);
        }
        return threadDump;
    } else {
        return null;
    }
}
Also used : TThreadState(com.navercorp.pinpoint.thrift.dto.command.TThreadState) TMonitorInfo(com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo) MonitorInfoMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) ThreadDumpMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)

Aggregations

ThreadDumpMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot)10 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)5 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)3 TActiveThreadDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump)3 ThreadInfo (java.lang.management.ThreadInfo)3 ActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)2 MonitorInfoMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.MonitorInfoMetricSnapshot)2 ArrayList (java.util.ArrayList)2 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 DeadlockMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.deadlock.DeadlockMetricSnapshot)1 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)1 TMonitorInfo (com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo)1 TThreadState (com.navercorp.pinpoint.thrift.dto.command.TThreadState)1 AgentActiveThreadDumpFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory)1