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