Search in sources :

Example 6 with TFAgentStat

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");
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) Test(org.junit.Test)

Example 7 with TFAgentStat

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);
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFActiveTraceHistogram(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram) TFActiveTrace(com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 8 with TFAgentStat

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);
}
Also used : AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) Test(org.junit.Test)

Example 9 with TFAgentStat

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();
}
Also used : JoinAgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)

Example 10 with TFAgentStat

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"));
}
Also used : JoinDataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo) JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFAgentStat(com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo) Test(org.junit.Test)

Aggregations

TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)43 Test (org.junit.Test)36 ArrayList (java.util.ArrayList)15 TFAgentStatBatch (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch)14 JoinLongFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo)10 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)9 JoinAgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo)8 TFJvmGc (com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc)4 TFResponseTime (com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime)4 JoinActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo)3 JoinCpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo)3 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)3 JoinLoadedClassBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo)3 JoinMemoryBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo)3 JoinResponseTimeBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo)3 JoinTotalThreadCountBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo)3 JoinTransactionBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo)3 TFActiveTrace (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace)3 TFActiveTraceHistogram (com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram)3 TFCpuLoad (com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad)3