use of com.navercorp.pinpoint.thrift.dto.TDeadlock in project pinpoint by naver.
the class ThriftDeadlockThreadCountBoMapperTest method create.
@Override
protected TDeadlock create() {
TDeadlock tDeadlock = new TDeadlock();
tDeadlock.setDeadlockedThreadCount(getRandomInteger(0, MAX_DEADLOCKED_THREAD_COUNT));
return tDeadlock;
}
use of com.navercorp.pinpoint.thrift.dto.TDeadlock in project pinpoint by naver.
the class ThriftAgentEventMapperTest method createAgentStat.
private TAgentStat createAgentStat(String agentId, long startTimestamp, long eventTimestamp, int deadlockThreadCount) {
final TAgentStat agentStat = new TAgentStat();
agentStat.setAgentId(agentId);
agentStat.setStartTimestamp(startTimestamp);
agentStat.setTimestamp(eventTimestamp);
if (deadlockThreadCount > 0) {
TDeadlock tDeadlock = new TDeadlock();
tDeadlock.setDeadlockedThreadCount(deadlockThreadCount);
for (int i = 0; i < deadlockThreadCount; i++) {
tDeadlock.addToDeadlockedThreadList(new TThreadDump());
}
agentStat.setDeadlock(tDeadlock);
}
return agentStat;
}
use of com.navercorp.pinpoint.thrift.dto.TDeadlock in project pinpoint by naver.
the class StatThriftMessageConverter method convertDeadlock.
private TDeadlock convertDeadlock(DeadlockMetricSnapshot deadlockMetricSnapshot) {
// Only send id values that have already been sent
final TDeadlock deadlock = new TDeadlock();
deadlock.setDeadlockedThreadCount(deadlockMetricSnapshot.getDeadlockedThreadCount());
for (ThreadDumpMetricSnapshot threadDumpMetricSnapshot : deadlockMetricSnapshot.getDeadlockedThreadList()) {
final TThreadDump threadDump = this.threadDumpMessageConverter.toMessage(threadDumpMetricSnapshot);
if (threadDump != null) {
deadlock.addToDeadlockedThreadList(threadDump);
}
}
return deadlock;
}
use of com.navercorp.pinpoint.thrift.dto.TDeadlock 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();
}
use of com.navercorp.pinpoint.thrift.dto.TDeadlock in project pinpoint by naver.
the class ThriftAgentEventMapper method map.
public AgentEventBo map(TAgentStat tAgentStat) {
if (tAgentStat == null) {
return null;
}
final String agentId = tAgentStat.getAgentId();
final long startTimestamp = tAgentStat.getStartTimestamp();
final long timestamp = tAgentStat.getTimestamp();
if (tAgentStat.isSetDeadlock()) {
TDeadlock deadlock = tAgentStat.getDeadlock();
if (deadlock != null && deadlock.isSetDeadlockedThreadList()) {
return deadlockEventBoMapper.map(agentId, startTimestamp, timestamp, deadlock);
}
}
return null;
}
Aggregations