use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat in project pinpoint by naver.
the class TFAgentStatMapperTest method map2Test.
@Test
public void map2Test() {
AgentStatBo agentStatBo = createDataSourceListBoList();
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);
assertTrue(tFAgentStat1.isSetDataSourceList());
List<TFDataSource> dataSourceList1 = tFAgentStat1.getDataSourceList().getDataSourceList();
assertEquals(dataSourceList1.size(), 2);
TFDataSource tfDataSource1_1 = dataSourceList1.get(0);
TFDataSource tfDataSource1_2 = dataSourceList1.get(1);
assertEquals(tfDataSource1_1.getId(), 1);
assertEquals(tfDataSource1_1.getUrl(), "jdbc:mysql");
assertEquals(tfDataSource1_1.getServiceTypeCode(), 1000);
assertEquals(tfDataSource1_1.getActiveConnectionSize(), 15);
assertEquals(tfDataSource1_1.getMaxConnectionSize(), 30);
assertEquals(tfDataSource1_1.getDatabaseName(), "pinpoint1");
assertEquals(tfDataSource1_2.getId(), 2);
assertEquals(tfDataSource1_2.getUrl(), "jdbc:mssql");
assertEquals(tfDataSource1_2.getServiceTypeCode(), 2000);
assertEquals(tfDataSource1_2.getActiveConnectionSize(), 25);
assertEquals(tfDataSource1_2.getMaxConnectionSize(), 40);
assertEquals(tfDataSource1_2.getDatabaseName(), "pinpoint2");
TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT);
assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp);
assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd);
assertTrue(tFAgentStat2.isSetDataSourceList());
List<TFDataSource> dataSourceList2 = tFAgentStat2.getDataSourceList().getDataSourceList();
assertEquals(dataSourceList2.size(), 2);
TFDataSource tfDataSource2_1 = dataSourceList2.get(0);
TFDataSource tfDataSource2_2 = dataSourceList2.get(1);
assertEquals(tfDataSource2_1.getId(), 1);
assertEquals(tfDataSource2_1.getUrl(), "jdbc:mysql");
assertEquals(tfDataSource2_1.getServiceTypeCode(), 1000);
assertEquals(tfDataSource2_1.getActiveConnectionSize(), 16);
assertEquals(tfDataSource2_1.getMaxConnectionSize(), 31);
assertEquals(tfDataSource2_1.getDatabaseName(), "pinpoint1");
assertEquals(tfDataSource2_2.getId(), 2);
assertEquals(tfDataSource2_2.getUrl(), "jdbc:mssql");
assertEquals(tfDataSource2_2.getServiceTypeCode(), 2000);
assertEquals(tfDataSource2_2.getActiveConnectionSize(), 26);
assertEquals(tfDataSource2_2.getMaxConnectionSize(), 41);
assertEquals(tfDataSource2_2.getDatabaseName(), "pinpoint2");
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat in project pinpoint by naver.
the class TFAgentStatMapperTest method map4Test.
@Test
public void map4Test() {
AgentStatBo agentStatBo = createActiveTraceBoList();
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);
TFActiveTrace activeTrace1 = tFAgentStat1.getActiveTrace();
TFActiveTraceHistogram histogram1 = activeTrace1.getHistogram();
List<Integer> activeTraceCount1 = histogram1.getActiveTraceCount();
assertEquals((int) activeTraceCount1.get(0), 30);
assertEquals((int) activeTraceCount1.get(1), 40);
assertEquals((int) activeTraceCount1.get(2), 10);
assertEquals((int) activeTraceCount1.get(3), 50);
TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT);
assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp);
assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd);
TFActiveTrace activeTrace2 = tFAgentStat2.getActiveTrace();
TFActiveTraceHistogram histogram2 = activeTrace2.getHistogram();
List<Integer> activeTraceCount2 = histogram2.getActiveTraceCount();
assertEquals((int) activeTraceCount2.get(0), 31);
assertEquals((int) activeTraceCount2.get(1), 41);
assertEquals((int) activeTraceCount2.get(2), 11);
assertEquals((int) activeTraceCount2.get(3), 51);
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat in project pinpoint by naver.
the class TFAgentStatMapperTest method mapTest.
@Test
public void mapTest() {
AgentStatBo agentStatBo = createCpuLoadBoList();
List<TFAgentStat> tFAgentStatList = newAgentStatMapper().map(agentStatBo);
assertEquals(3, tFAgentStatList.size());
TFAgentStat tFAgentStat1 = tFAgentStatList.get(0);
assertEquals(TEST_AGENT, tFAgentStat1.getAgentId());
assertEquals(startTimestamp, tFAgentStat1.getStartTimestamp());
assertEquals(collectTime1st, tFAgentStat1.getTimestamp());
assertEquals(4, tFAgentStat1.getCpuLoad().getJvmCpuLoad(), 0);
assertEquals(3, tFAgentStat1.getCpuLoad().getSystemCpuLoad(), 0);
TFAgentStat tFAgentStat2 = tFAgentStatList.get(1);
assertEquals(TEST_AGENT, tFAgentStat2.getAgentId());
assertEquals(startTimestamp, tFAgentStat2.getStartTimestamp());
assertEquals(collectTime2nd, tFAgentStat2.getTimestamp());
assertEquals(5, tFAgentStat2.getCpuLoad().getJvmCpuLoad(), 0);
assertEquals(6, tFAgentStat2.getCpuLoad().getSystemCpuLoad(), 0);
TFAgentStat tFAgentStat3 = tFAgentStatList.get(2);
assertEquals(TEST_AGENT, tFAgentStat3.getAgentId());
assertEquals(startTimestamp, tFAgentStat3.getStartTimestamp());
assertEquals(collectTime3rd, tFAgentStat3.getTimestamp());
assertEquals(8, tFAgentStat3.getCpuLoad().getJvmCpuLoad(), 0);
assertEquals(9, tFAgentStat3.getCpuLoad().getSystemCpuLoad(), 0);
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat in project pinpoint by naver.
the class JoinAgentStatBoMapper method map.
@Override
public JoinAgentStatBo map(TFAgentStatBatch tFAgentStatBatch) {
if (!tFAgentStatBatch.isSetAgentStats()) {
return JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO;
}
if (StringUtils.isEmpty(tFAgentStatBatch.getAgentId())) {
return JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO;
}
final String agentId = tFAgentStatBatch.getAgentId();
final long startTimestamp = tFAgentStatBatch.getStartTimestamp();
final long timeStamp = getTimeStamp(tFAgentStatBatch);
JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder(agentId, startTimestamp, timeStamp);
for (TFAgentStat agentStat : tFAgentStatBatch.getAgentStats()) {
for (ThriftStatMapper<?, ?> mapper : mappers) {
mapper.build(agentStat, builder);
}
}
return builder.build();
}
use of com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat in project pinpoint by naver.
the class JoinDataSourceListBoMapperTest method mapTest.
@Test
public void mapTest() {
JoinDataSourceListBoMapper mapper = new JoinDataSourceListBoMapper();
TFAgentStat tFAgentStat = new TFAgentStat();
tFAgentStat.setAgentId("testAgent");
tFAgentStat.setTimestamp(1491274138454L);
TFDataSourceList tFDataSourceList = new TFDataSourceList();
List<TFDataSource> dataSourceList = new ArrayList<>();
TFDataSource tFDataSource1 = new TFDataSource();
tFDataSource1.setUrl("jdbc:mysql");
tFDataSource1.setMaxConnectionSize(30);
tFDataSource1.setActiveConnectionSize(13);
tFDataSource1.setDatabaseName("pinpoint");
tFDataSource1.setServiceTypeCode((short) 1000);
TFDataSource tFDataSource2 = new TFDataSource();
tFDataSource2.setUrl("jdbc:mssql");
tFDataSource2.setMaxConnectionSize(31);
tFDataSource2.setActiveConnectionSize(23);
tFDataSource2.setDatabaseName("pinpoint");
tFDataSource2.setServiceTypeCode((short) 2000);
dataSourceList.add(tFDataSource1);
dataSourceList.add(tFDataSource2);
tFDataSourceList.setDataSourceList(dataSourceList);
tFAgentStat.setDataSourceList(tFDataSourceList);
JoinDataSourceListBo joinDataSourceListBo = mapper.map(tFAgentStat);
assertEquals(joinDataSourceListBo.getId(), "testAgent");
assertEquals(joinDataSourceListBo.getTimestamp(), 1491274138454L);
assertEquals(joinDataSourceListBo.getJoinDataSourceBoList().size(), 2);
List<JoinDataSourceBo> joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList();
JoinDataSourceBo joinDataSourceBo1 = joinDataSourceBoList.get(0);
assertEquals(joinDataSourceBo1.getServiceTypeCode(), 1000);
assertEquals(joinDataSourceBo1.getUrl(), "jdbc:mysql");
assertEquals(joinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(13, 13, "testAgent", 13, "testAgent"));
JoinDataSourceBo joinDataSourceBo2 = joinDataSourceBoList.get(1);
assertEquals(joinDataSourceBo2.getServiceTypeCode(), 2000);
assertEquals(joinDataSourceBo2.getUrl(), "jdbc:mssql");
assertEquals(joinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(23, 23, "testAgent", 23, "testAgent"));
}
Aggregations