use of com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime in project pinpoint by naver.
the class JoinAgentStatBoMapperTest method map5Test.
@Test
public void map5Test() {
final String agentId = "testAgent";
final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper();
final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch();
tFAgentStatBatch.setStartTimestamp(1491274138454L);
tFAgentStatBatch.setAgentId(agentId);
final TFResponseTime tFResponseTime = new TFResponseTime();
tFResponseTime.setAvg(100);
final TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId(agentId);
tFAgentStat.setTimestamp(1491274148454L);
tFAgentStat.setResponseTime(tFResponseTime);
final TFResponseTime tFResponseTime2 = new TFResponseTime();
tFResponseTime2.setAvg(120);
final TFAgentStat tFAgentStat2 = new TFAgentStat();
tFAgentStat2.setAgentId(agentId);
tFAgentStat2.setTimestamp(1491275148454L);
tFAgentStat2.setResponseTime(tFResponseTime2);
final List<TFAgentStat> tFAgentStatList = new ArrayList<>(2);
tFAgentStatList.add(tFAgentStat);
tFAgentStatList.add(tFAgentStat2);
tFAgentStatBatch.setAgentStats(tFAgentStatList);
JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch);
assertEquals(joinAgentStatBo.getId(), agentId);
assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L);
assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L);
List<JoinResponseTimeBo> joinResponseTimeBoList = joinAgentStatBo.getJoinResponseTimeBoList();
assertEquals(joinResponseTimeBoList.size(), 2);
JoinResponseTimeBo joinResponseTimeBo = joinResponseTimeBoList.get(0);
assertEquals(joinResponseTimeBo.getId(), agentId);
assertEquals(joinResponseTimeBo.getTimestamp(), 1491274148454L);
assertEquals(joinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId));
JoinResponseTimeBo joinResponseTimeBo2 = joinResponseTimeBoList.get(1);
assertEquals(joinResponseTimeBo2.getId(), agentId);
assertEquals(joinResponseTimeBo2.getTimestamp(), 1491275148454L);
assertEquals(joinResponseTimeBo2.getResponseTimeJoinValue(), new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId));
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime in project pinpoint by naver.
the class JoinResponseTimeBoMapper method map.
public JoinResponseTimeBo map(TFAgentStat tFAgentStat) {
if (!tFAgentStat.isSetResponseTime()) {
return JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO;
}
final String agentId = tFAgentStat.getAgentId();
final TFResponseTime tFResponseTime = tFAgentStat.getResponseTime();
final long avg = tFResponseTime.getAvg();
JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo();
joinResponseTimeBo.setId(agentId);
joinResponseTimeBo.setTimestamp(tFAgentStat.getTimestamp());
joinResponseTimeBo.setResponseTimeJoinValue(new JoinLongFieldBo(avg, avg, agentId, avg, agentId));
return joinResponseTimeBo;
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime in project pinpoint by naver.
the class TFResponseTimeMapper method map.
public TFResponseTime map(ResponseTimeBo responseTimeBo) {
TFResponseTime tFResponseTime = new TFResponseTime();
tFResponseTime.setAvg(responseTimeBo.getAvg());
return tFResponseTime;
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime in project pinpoint by naver.
the class TFAgentStatMapperTest method map5Test.
@Test
public void map5Test() {
AgentStatBo agentStatBo = createResponseTimeBoList();
List<TFAgentStat> tFAgentStatList = newAgentStatMapper().map(agentStatBo);
assertEquals(2, tFAgentStatList.size());
TFAgentStat tFAgentStat1 = tFAgentStatList.get(0);
assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT);
assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp);
assertEquals(tFAgentStat1.getTimestamp(), collectTime1st);
TFResponseTime responseTime1 = tFAgentStat1.getResponseTime();
assertEquals(responseTime1.getAvg(), 1000);
TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT);
assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp);
assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd);
TFResponseTime responseTime2 = tFAgentStat2.getResponseTime();
assertEquals(responseTime2.getAvg(), 2000);
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime in project pinpoint by naver.
the class TFResponseTimeMapperTest method mapTest.
@Test
public void mapTest() {
TFResponseTimeMapper mapper = new TFResponseTimeMapper();
ResponseTimeBo responseTimeBo = new ResponseTimeBo();
responseTimeBo.setAvg(50);
TFResponseTime tFResponseTime = mapper.map(responseTimeBo);
assertEquals(tFResponseTime.getAvg(), 50);
}
Aggregations