use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by naver.
the class AgentActiveThreadDumpListTest method createThreadDumpList.
private AgentActiveThreadDumpList createThreadDumpList(Thread[] threads) {
List<TActiveThreadDump> activeThreadDumpList = new ArrayList<>();
for (Thread thread : threads) {
TActiveThreadDump tActiveThreadDump = new TActiveThreadDump();
tActiveThreadDump.setStartTime(System.currentTimeMillis() - ThreadLocalRandom.current().nextLong(100000));
final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = ThreadDumpUtils.createThreadDump(thread);
final TThreadDump threadDump = this.threadDumpThriftMessageConverter.toMessage(threadDumpMetricSnapshot);
tActiveThreadDump.setThreadDump(threadDump);
activeThreadDumpList.add(tActiveThreadDump);
}
AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
return factory.create1(activeThreadDumpList);
}
use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by pinpoint-apm.
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;
}
}
use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by pinpoint-apm.
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();
}
use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by pinpoint-apm.
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;
}
use of com.navercorp.pinpoint.profiler.monitor.metric.deadlock.ThreadDumpMetricSnapshot in project pinpoint by pinpoint-apm.
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