use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.
the class AgentStatHandlerV2Test method testHandleForTAgentStat.
@Test
public void testHandleForTAgentStat() {
// Given
final String agentId = "agentId";
final long startTimestamp = Long.MAX_VALUE;
final TAgentStat agentStat = createAgentStat(agentId, startTimestamp);
final AgentStatBo mappedAgentStat = new AgentStatBo();
when(this.agentStatMapper.map(agentStat)).thenReturn(mappedAgentStat);
// When
agentStatHandler.handle(agentStat);
// Then
verify(jvmGcDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getJvmGcBos());
verify(jvmGcDetailedDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getJvmGcDetailedBos());
verify(cpuLoadDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getCpuLoadBos());
verify(transactionDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getTransactionBos());
verify(activeTraceDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getActiveTraceBos());
verify(dataSourceDao).insert(mappedAgentStat.getAgentId(), mappedAgentStat.getDataSourceListBos());
}
use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.
the class ThriftAgentEventMapperTest method simpleTest2.
@Test
public void simpleTest2() {
final String agentId = "agentId";
final long startTimestamp = Long.MAX_VALUE;
final long eventTimestamp = startTimestamp;
final TAgentStat agentStat = createAgentStat(agentId, startTimestamp, eventTimestamp, 0);
DeadlockBo deadlockBo = new DeadlockBo();
DeadlockEventBo expectedEventBo = new DeadlockEventBo(agentId, startTimestamp, eventTimestamp, AgentEventType.AGENT_DEADLOCK_DETECTED, deadlockBo);
when(this.deadlockEventBoMapper.map(any(String.class), any(Long.class), any(Long.class), any(TDeadlock.class))).thenReturn(expectedEventBo);
AgentEventBo actualEventBo = agentEventMapper.map(agentStat);
Assert.assertNull(actualEventBo);
}
use of com.navercorp.pinpoint.thrift.dto.TAgentStat 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.TAgentStat in project pinpoint by naver.
the class ThriftAgentStatBatchMapper method map.
public AgentStatBo map(TAgentStatBatch tAgentStatBatch) {
if (!tAgentStatBatch.isSetAgentStats()) {
return null;
}
final String agentId = tAgentStatBatch.getAgentId();
final long startTimestamp = tAgentStatBatch.getStartTimestamp();
AgentStatBo.Builder builder = AgentStatBo.newBuilder(agentId, startTimestamp);
for (TAgentStat tAgentStat : tAgentStatBatch.getAgentStats()) {
this.statMapper.map(builder, tAgentStat);
}
return builder.build();
}
use of com.navercorp.pinpoint.thrift.dto.TAgentStat in project pinpoint by naver.
the class DefaultTBaseLocator method addBodyFactory.
public static void addBodyFactory(TypeLocatorBuilder<TBase<?, ?>> builder) {
builder.addBodyFactory(SPAN, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpan();
}
});
builder.addBodyFactory(AGENT_INFO, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentInfo();
}
});
builder.addBodyFactory(AGENT_STAT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentStat();
}
});
builder.addBodyFactory(AGENT_STAT_BATCH, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TAgentStatBatch();
}
});
builder.addBodyFactory(SPANCHUNK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpanChunk();
}
});
builder.addBodyFactory(SPANEVENT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSpanEvent();
}
});
builder.addBodyFactory(SQLMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TSqlMetaData();
}
});
builder.addBodyFactory(APIMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TApiMetaData();
}
});
builder.addBodyFactory(RESULT, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TResult();
}
});
builder.addBodyFactory(STRINGMETADATA, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new TStringMetaData();
}
});
builder.addBodyFactory(NETWORK_CHECK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return new NetworkAvailabilityCheckPacket();
}
});
builder.addBodyFactory(CHUNK, new BodyFactory<TBase<?, ?>>() {
@Override
public TBase<?, ?> getObject() {
return null;
}
});
}
Aggregations