use of com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo 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.common.server.bo.stat.AgentStatBo in project pinpoint by naver.
the class TFAgentStatMapperTest method createDataSourceListBoList.
private AgentStatBo createDataSourceListBoList() {
AgentStatBo.Builder builder = AgentStatBo.newBuilder(TEST_AGENT, startTimestamp);
DataSourceListBo dataSourceListBo1 = new DataSourceListBo();
DataSourceBo dataSourceBo1_1 = new DataSourceBo();
dataSourceBo1_1.setServiceTypeCode((short) 1000);
dataSourceBo1_1.setJdbcUrl("jdbc:mysql");
dataSourceBo1_1.setActiveConnectionSize(15);
dataSourceBo1_1.setMaxConnectionSize(30);
dataSourceBo1_1.setId(1);
dataSourceBo1_1.setDatabaseName("pinpoint1");
DataSourceBo dataSourceBo1_2 = new DataSourceBo();
dataSourceBo1_2.setServiceTypeCode((short) 2000);
dataSourceBo1_2.setJdbcUrl("jdbc:mssql");
dataSourceBo1_2.setActiveConnectionSize(25);
dataSourceBo1_2.setMaxConnectionSize(40);
dataSourceBo1_2.setId(2);
dataSourceBo1_2.setDatabaseName("pinpoint2");
dataSourceListBo1.add(dataSourceBo1_1);
dataSourceListBo1.add(dataSourceBo1_2);
DataSourceListBo dataSourceListBo2 = new DataSourceListBo();
DataSourceBo dataSourceBo2_1 = new DataSourceBo();
dataSourceBo2_1.setServiceTypeCode((short) 1000);
dataSourceBo2_1.setJdbcUrl("jdbc:mysql");
dataSourceBo2_1.setActiveConnectionSize(16);
dataSourceBo2_1.setMaxConnectionSize(31);
dataSourceBo2_1.setId(1);
dataSourceBo2_1.setDatabaseName("pinpoint1");
DataSourceBo dataSourceBo2_2 = new DataSourceBo();
dataSourceBo2_2.setServiceTypeCode((short) 2000);
dataSourceBo2_2.setJdbcUrl("jdbc:mssql");
dataSourceBo2_2.setActiveConnectionSize(26);
dataSourceBo2_2.setMaxConnectionSize(41);
dataSourceBo2_2.setId(2);
dataSourceBo2_2.setDatabaseName("pinpoint2");
dataSourceListBo2.add(dataSourceBo2_1);
dataSourceListBo2.add(dataSourceBo2_2);
AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st);
statBuilder1.addDataSourceList(dataSourceListBo1);
AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd);
statBuilder2.addDataSourceList(dataSourceListBo2);
return builder.build();
}
use of com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo in project pinpoint by naver.
the class TFAgentStatMapperTest method createFileDescriptorBoList.
private AgentStatBo createFileDescriptorBoList() {
final AgentStatBo.Builder builder = newBuilder();
FileDescriptorBo fileDescriptorBo1 = new FileDescriptorBo();
fileDescriptorBo1.setOpenFileDescriptorCount(4);
AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st);
statBuilder1.addFileDescriptor(fileDescriptorBo1);
FileDescriptorBo fileDescriptorBo2 = new FileDescriptorBo();
fileDescriptorBo2.setOpenFileDescriptorCount(5);
AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd);
statBuilder2.addFileDescriptor(fileDescriptorBo2);
FileDescriptorBo fileDescriptorBo3 = new FileDescriptorBo();
fileDescriptorBo3.setOpenFileDescriptorCount(8);
AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd);
statBuilder3.addFileDescriptor(fileDescriptorBo3);
return builder.build();
}
use of com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo 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.common.server.bo.stat.AgentStatBo in project pinpoint by naver.
the class AgentStatHandlerV2 method handleAgentStatBatch.
private void handleAgentStatBatch(TAgentStatBatch tAgentStatBatch) {
if (logger.isDebugEnabled()) {
logger.debug("Received TAgentStatBatch={}", tAgentStatBatch);
}
AgentStatBo agentStatBo = this.agentStatBatchMapper.map(tAgentStatBatch);
this.insertAgentStatBatch(agentStatBo);
}
Aggregations