Search in sources :

Example 1 with ThreadDumpBo

use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo 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;
}
Also used : DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) ArrayList(java.util.ArrayList) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo) PThreadDump(com.navercorp.pinpoint.grpc.trace.PThreadDump)

Example 2 with ThreadDumpBo

use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.

the class ThriftDeadlockBoMapper method map.

public DeadlockBo map(final TDeadlock tDeadlock) {
    final DeadlockBo deadlockBo = new DeadlockBo();
    deadlockBo.setDeadlockedThreadCount(tDeadlock.getDeadlockedThreadCount());
    if (tDeadlock.isSetDeadlockedThreadList()) {
        final List<ThreadDumpBo> threadDumpBoList = new ArrayList<>();
        for (TThreadDump threadDump : tDeadlock.getDeadlockedThreadList()) {
            final ThreadDumpBo threadDumpBo = this.threadDumpBoMapper.map(threadDump);
            threadDumpBoList.add(threadDumpBo);
        }
        deadlockBo.setThreadDumpBoList(threadDumpBoList);
    }
    return deadlockBo;
}
Also used : DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) ArrayList(java.util.ArrayList) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 3 with ThreadDumpBo

use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo 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;
}
Also used : ArrayList(java.util.ArrayList) MonitorInfoBo(com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 4 with ThreadDumpBo

use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.

the class AgentEventMessageSerializerV1 method serializeDeadlockBo.

private byte[] serializeDeadlockBo(final DeadlockBo deadlockBo) {
    final Buffer buffer = new AutomaticBuffer();
    buffer.putInt(deadlockBo.getDeadlockedThreadCount());
    // Put ThreadDumpBoList
    final int threadDumpBoListSize = deadlockBo.getThreadDumpBoList() == null ? 0 : deadlockBo.getThreadDumpBoList().size();
    buffer.putVInt(threadDumpBoListSize);
    if (threadDumpBoListSize > 0) {
        for (ThreadDumpBo threadDumpBo : deadlockBo.getThreadDumpBoList()) {
            putThreadDumpBo(buffer, threadDumpBo);
        }
    }
    return buffer.getBuffer();
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Example 5 with ThreadDumpBo

use of com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo in project pinpoint by naver.

the class AgentEventSerializer method serialize.

@Override
public void serialize(AgentEvent agentEvent, JsonGenerator jgen, SerializerProvider serializers) throws IOException {
    jgen.writeStartObject();
    if (agentEvent.getAgentId() != null) {
        jgen.writeStringField("agentId", agentEvent.getAgentId());
    }
    jgen.writeNumberField("startTimestamp", agentEvent.getStartTimestamp());
    jgen.writeNumberField("eventTimestamp", agentEvent.getEventTimestamp());
    jgen.writeNumberField("eventTypeCode", agentEvent.getEventTypeCode());
    if (agentEvent.getEventTypeDesc() != null) {
        jgen.writeStringField("eventTypeDesc", agentEvent.getEventTypeDesc());
    }
    jgen.writeBooleanField("hasEventMessage", agentEvent.hasEventMessage());
    if (agentEvent.getEventMessage() != null) {
        Object eventMessage = agentEvent.getEventMessage();
        if (eventMessage instanceof TDeadlock) {
            StringBuilder message = new StringBuilder();
            List<TThreadDump> deadlockedThreadList = ((TDeadlock) eventMessage).getDeadlockedThreadList();
            for (TThreadDump threadDump : deadlockedThreadList) {
                message.append(ThreadDumpUtils.createDumpMessage(threadDump));
            }
            jgen.writeObjectField("eventMessage", message.toString());
        } else if (eventMessage instanceof DeadlockBo) {
            final StringBuilder message = new StringBuilder();
            final List<ThreadDumpBo> threadDumpBoList = ((DeadlockBo) eventMessage).getThreadDumpBoList();
            for (ThreadDumpBo threadDump : threadDumpBoList) {
                message.append(ThreadDumpUtils.createDumpMessage(threadDump));
            }
            jgen.writeObjectField("eventMessage", message.toString());
        } else {
            jgen.writeObjectField("eventMessage", eventMessage);
        }
    }
    jgen.writeEndObject();
}
Also used : TDeadlock(com.navercorp.pinpoint.thrift.dto.TDeadlock) DeadlockBo(com.navercorp.pinpoint.common.server.bo.event.DeadlockBo) TThreadDump(com.navercorp.pinpoint.thrift.dto.command.TThreadDump) List(java.util.List) ThreadDumpBo(com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)

Aggregations

ThreadDumpBo (com.navercorp.pinpoint.common.server.bo.event.ThreadDumpBo)9 ArrayList (java.util.ArrayList)7 DeadlockBo (com.navercorp.pinpoint.common.server.bo.event.DeadlockBo)5 MonitorInfoBo (com.navercorp.pinpoint.common.server.bo.event.MonitorInfoBo)4 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 TThreadDump (com.navercorp.pinpoint.thrift.dto.command.TThreadDump)2 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 PMonitorInfo (com.navercorp.pinpoint.grpc.trace.PMonitorInfo)1 PThreadDump (com.navercorp.pinpoint.grpc.trace.PThreadDump)1 PThreadState (com.navercorp.pinpoint.grpc.trace.PThreadState)1 TDeadlock (com.navercorp.pinpoint.thrift.dto.TDeadlock)1 TMonitorInfo (com.navercorp.pinpoint.thrift.dto.command.TMonitorInfo)1 TThreadState (com.navercorp.pinpoint.thrift.dto.command.TThreadState)1 List (java.util.List)1 Test (org.junit.Test)1