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