use of com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo in project pinpoint by naver.
the class GrpcMonitorInfoBoMapper method map.
public MonitorInfoBo map(final PMonitorInfo monitorInfo) {
final MonitorInfoBo monitorInfoBo = new MonitorInfoBo();
monitorInfoBo.setStackDepth(monitorInfo.getStackDepth());
monitorInfoBo.setStackFrame(monitorInfo.getStackFrame());
return monitorInfoBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo in project pinpoint by naver.
the class AgentEventMessageDeserializerV1 method readThreadDumpBo.
private ThreadDumpBo readThreadDumpBo(final Buffer buffer) {
final String threadName = buffer.readPrefixedString();
final long threadId = buffer.readLong();
final long blockedTime = buffer.readLong();
final long blockedCount = buffer.readLong();
final long waitedTime = buffer.readLong();
final long waitedCount = buffer.readLong();
final String lockName = buffer.readPrefixedString();
final long lockOwnerId = buffer.readLong();
final String lockOwnerName = buffer.readPrefixedString();
final boolean inNative = buffer.readBoolean();
final boolean suspended = buffer.readBoolean();
final int threadStateValue = buffer.readInt();
final int stackTraceListSize = buffer.readVInt();
final List<String> stackTraceList = new ArrayList<>(stackTraceListSize);
if (stackTraceListSize > 0) {
for (int i = 0; i < stackTraceListSize; i++) {
final String string = buffer.readPrefixedString();
stackTraceList.add(string);
}
}
final int lockedMonitorListSize = buffer.readVInt();
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>(lockedMonitorListSize);
if (lockedMonitorListSize > 0) {
for (int i = 0; i < lockedMonitorListSize; i++) {
final MonitorInfoBo monitorInfoBo = readMonitorInfoBo(buffer);
monitorInfoBoList.add(monitorInfoBo);
}
}
final int lockedSynchronizerListSize = buffer.readVInt();
final List<String> lockedSynchronizerList = new ArrayList<>(lockedSynchronizerListSize);
if (lockedSynchronizerListSize > 0) {
for (int i = 0; i < lockedSynchronizerListSize; i++) {
final String string = buffer.readPrefixedString();
lockedSynchronizerList.add(string);
}
}
final ThreadDumpBo threadDumpBo = new ThreadDumpBo();
threadDumpBo.setThreadName(threadName);
threadDumpBo.setThreadId(threadId);
threadDumpBo.setBlockedTime(blockedTime);
threadDumpBo.setBlockedCount(blockedCount);
threadDumpBo.setWaitedTime(waitedTime);
threadDumpBo.setWaitedCount(waitedCount);
threadDumpBo.setLockName(lockName);
threadDumpBo.setLockOwnerId(lockOwnerId);
threadDumpBo.setLockOwnerName(lockOwnerName);
threadDumpBo.setInNative(inNative);
threadDumpBo.setSuspended(suspended);
threadDumpBo.setThreadState(ThreadState.findByValue(threadStateValue));
threadDumpBo.setStackTraceList(stackTraceList);
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
threadDumpBo.setLockedSynchronizerList(lockedSynchronizerList);
return threadDumpBo;
}
use of com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo in project pinpoint by naver.
the class ThreadDumpUtils method createDumpMessage.
public static String createDumpMessage(ThreadDumpBo threadDump) {
ThreadState threadState = getThreadState(threadDump.getThreadState());
// set threadName
StringBuilder message = new StringBuilder("\"" + threadDump.getThreadName() + "\"");
// set threadId
String hexStringThreadId = Long.toHexString(threadDump.getThreadId());
message.append(" Id=0x" + hexStringThreadId);
// set threadState
message.append(" " + threadState.name());
if (!StringUtils.isBlank(threadDump.getLockName())) {
message.append(" on ").append(threadDump.getLockName());
}
if (!StringUtils.isBlank(threadDump.getLockOwnerName())) {
message.append(" owned by \"").append(threadDump.getLockOwnerName()).append("\" Id=").append(threadDump.getLockOwnerId());
}
if (threadDump.isSuspended()) {
message.append(" (suspended)");
}
if (threadDump.isInNative()) {
message.append(" (in native)");
}
message.append(LINE_SEPARATOR);
// set StackTrace
final int stackTraceSize = threadDump.getStackTraceList().size();
for (int i = 0; i < stackTraceSize; i++) {
final String stackTrace = threadDump.getStackTraceList().get(i);
message.append(TAB_SEPARATOR + "at ").append(stackTrace);
message.append(LINE_SEPARATOR);
if (i == 0 && !StringUtils.isBlank(threadDump.getLockName())) {
switch(threadState) {
case BLOCKED:
message.append(TAB_SEPARATOR + "- blocked on ").append(threadDump.getLockName());
message.append(LINE_SEPARATOR);
break;
case WAITING:
message.append(TAB_SEPARATOR + "- waiting on ").append(threadDump.getLockName());
message.append(LINE_SEPARATOR);
break;
case TIMED_WAITING:
message.append(TAB_SEPARATOR + "- waiting on ").append(threadDump.getLockName());
message.append(LINE_SEPARATOR);
break;
default:
}
}
if (CollectionUtils.hasLength(threadDump.getLockedMonitorInfoList())) {
for (MonitorInfoBo lockedMonitor : threadDump.getLockedMonitorInfoList()) {
if (lockedMonitor.getStackDepth() == i) {
message.append(TAB_SEPARATOR + "- locked ").append(lockedMonitor.getStackFrame());
message.append(LINE_SEPARATOR);
}
}
}
}
// set Locks
List<String> lockedSynchronizerList = threadDump.getLockedSynchronizerList();
if (CollectionUtils.hasLength(lockedSynchronizerList)) {
message.append(LINE_SEPARATOR + TAB_SEPARATOR + "Number of locked synchronizers = ").append(lockedSynchronizerList.size());
message.append(LINE_SEPARATOR);
for (String lockedSynchronizer : lockedSynchronizerList) {
message.append(TAB_SEPARATOR + "- ").append(lockedSynchronizer);
message.append(LINE_SEPARATOR);
}
}
message.append(LINE_SEPARATOR);
return message.toString();
}
use of com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo 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;
}
use of com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo in project pinpoint by naver.
the class ThriftThreadDumpBoMapper method map.
public ThreadDumpBo map(final TThreadDump 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.isInNative());
threadDumpBo.setSuspended(threadDump.isSuspended());
final TThreadState threadState = threadDump.getThreadState();
threadDumpBo.setThreadState(this.threadStateMapper.map(threadState));
threadDumpBo.setStackTraceList(threadDump.getStackTrace());
if (CollectionUtils.hasLength(threadDump.getLockedMonitors())) {
final List<MonitorInfoBo> monitorInfoBoList = new ArrayList<>();
for (TMonitorInfo monitorInfo : threadDump.getLockedMonitors()) {
final MonitorInfoBo monitorInfoBo = this.monitorInfoBoMapper.map(monitorInfo);
monitorInfoBoList.add(monitorInfoBo);
}
threadDumpBo.setLockedMonitorInfoList(monitorInfoBoList);
}
threadDumpBo.setLockedSynchronizerList(threadDump.getLockedSynchronizers());
return threadDumpBo;
}
Aggregations