use of com.navercorp.pinpoint.grpc.trace.PThreadState 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;
}
}
use of com.navercorp.pinpoint.grpc.trace.PThreadState in project pinpoint by naver.
the class GrpcThreadDumpBoMapper method map.
public ThreadDumpBo map(final PThreadDump threadDump) {
final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName(threadDump.getThreadName());
threadDumpBo.setThreadId(threadDump.getThreadId());
threadDumpBo.setBlockedTime(threadDump.getBlockedTime());
threadDumpBo.setBlockedCount(threadDump.getBlockedCount());
threadDumpBo.setWaitedTime(threadDump.getWaitedTime());
threadDumpBo.setWaitedCount(threadDump.getWaitedCount());
threadDumpBo.setLockName(threadDump.getLockName());
threadDumpBo.setLockOwnerId(threadDump.getLockOwnerId());
threadDumpBo.setLockOwnerName(threadDump.getLockOwnerName());
threadDumpBo.setInNative(threadDump.getInNative());
threadDumpBo.setSuspended(threadDump.getSuspended());
final PThreadState threadState = threadDump.getThreadState();
threadDumpBo.setThreadState(this.threadStateMapper.map(threadState));
threadDumpBo.setStackTraceList(threadDump.getStackTraceList());
if (CollectionUtils.hasLength(threadDump.getLockedMonitorList())) {
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
for (PMonitorInfo monitorInfo : threadDump.getLockedMonitorList()) {
final MonitorInfoBo monitorInfoBo = this.monitorInfoBoMapper.map(monitorInfo);
monitorInfoBoList.add(monitorInfoBo);
}
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
}
threadDumpBo.setLockedSynchronizerList(threadDump.getLockedSynchronizerList());
return threadDumpBo;
}
Aggregations