Search in sources :

Example 1 with TFDataSource

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSource in project pinpoint by naver.

the class TFDataSourceListBoMapperTest method mapTest.

@Test
public void mapTest() {
    DataSourceListBo dataSourceListBo = new DataSourceListBo();
    dataSourceListBo.setAgentId("test_agent1");
    dataSourceListBo.setStartTimestamp(startTimestamp);
    dataSourceListBo.setTimestamp(collectTime1st);
    DataSourceBo dataSourceBo1 = new DataSourceBo();
    dataSourceBo1.setAgentId("test_agent1");
    dataSourceBo1.setTimestamp(collectTime1st);
    dataSourceBo1.setServiceTypeCode((short) 1000);
    dataSourceBo1.setJdbcUrl("jdbc:mysql");
    dataSourceBo1.setActiveConnectionSize(15);
    dataSourceBo1.setMaxConnectionSize(30);
    dataSourceBo1.setId(1);
    dataSourceBo1.setDatabaseName("pinpoint1");
    DataSourceBo dataSourceBo2 = new DataSourceBo();
    dataSourceBo2.setAgentId("test_agent1");
    dataSourceBo2.setTimestamp(collectTime1st);
    dataSourceBo2.setServiceTypeCode((short) 2000);
    dataSourceBo2.setJdbcUrl("jdbc:mssql");
    dataSourceBo2.setActiveConnectionSize(25);
    dataSourceBo2.setMaxConnectionSize(40);
    dataSourceBo2.setId(2);
    dataSourceBo2.setDatabaseName("pinpoint2");
    dataSourceListBo.add(dataSourceBo1);
    dataSourceListBo.add(dataSourceBo2);
    TFDataSourceListBoMapper tFDataSourceListBoMapper = new TFDataSourceListBoMapper();
    TFDataSourceList tfDataSourceList = tFDataSourceListBoMapper.map(dataSourceListBo);
    List<TFDataSource> dataSourceList = tfDataSourceList.getDataSourceList();
    assertEquals(dataSourceList.size(), 2);
    TFDataSource tfDataSource1 = dataSourceList.get(0);
    assertEquals(tfDataSource1.getId(), 1);
    assertEquals(tfDataSource1.getUrl(), "jdbc:mysql");
    assertEquals(tfDataSource1.getDatabaseName(), "pinpoint1");
    assertEquals(tfDataSource1.getActiveConnectionSize(), 15);
    assertEquals(tfDataSource1.getMaxConnectionSize(), 30);
    assertEquals(tfDataSource1.getServiceTypeCode(), 1000);
    TFDataSource tfDataSource2 = dataSourceList.get(1);
    assertEquals(tfDataSource2.getId(), 2);
    assertEquals(tfDataSource2.getUrl(), "jdbc:mssql");
    assertEquals(tfDataSource2.getDatabaseName(), "pinpoint2");
    assertEquals(tfDataSource2.getActiveConnectionSize(), 25);
    assertEquals(tfDataSource2.getMaxConnectionSize(), 40);
    assertEquals(tfDataSource2.getServiceTypeCode(), 2000);
}
Also used : TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) Test(org.junit.Test)

Example 2 with TFDataSource

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSource 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 3 with TFDataSource

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSource in project pinpoint by naver.

the class JoinDataSourceListBoMapper method map.

@Override
public JoinDataSourceListBo map(TFAgentStat tFAgentStat) {
    if (!tFAgentStat.isSetDataSourceList()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    TFDataSourceList dataSourceList = tFAgentStat.getDataSourceList();
    if (!dataSourceList.isSetDataSourceList()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    List<TFDataSource> tFDataSourceList = dataSourceList.getDataSourceList();
    if (tFDataSourceList.isEmpty()) {
        return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO;
    }
    final String agentId = tFAgentStat.getAgentId();
    JoinDataSourceListBo joinDataSourceListBo = new JoinDataSourceListBo();
    joinDataSourceListBo.setId(agentId);
    joinDataSourceListBo.setTimestamp(tFAgentStat.getTimestamp());
    List<JoinDataSourceBo> joinDataSourceBoList = new ArrayList<>();
    for (TFDataSource tFDataSource : tFDataSourceList) {
        JoinDataSourceBo joinDataSourceBo = new JoinDataSourceBo();
        joinDataSourceBo.setServiceTypeCode(tFDataSource.getServiceTypeCode());
        joinDataSourceBo.setUrl(tFDataSource.getUrl());
        final int activeConnectionSize = tFDataSource.getActiveConnectionSize();
        joinDataSourceBo.setActiveConnectionSizeJoinValue(new JoinIntFieldBo(activeConnectionSize, activeConnectionSize, agentId, activeConnectionSize, agentId));
        joinDataSourceBoList.add(joinDataSourceBo);
    }
    joinDataSourceListBo.setJoinDataSourceBoList(joinDataSourceBoList);
    return joinDataSourceListBo;
}
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) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)

Example 4 with TFDataSource

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSource 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)

Example 5 with TFDataSource

use of com.navercorp.pinpoint.thrift.dto.flink.TFDataSource in project pinpoint by naver.

the class TFDataSourceListBoMapper method map.

public TFDataSourceList map(DataSourceListBo dataSourceListBo) {
    List<DataSourceBo> dataSourceBoList = dataSourceListBo.getList();
    List<TFDataSource> dataSourceList = new ArrayList<>(dataSourceBoList.size());
    for (DataSourceBo dataSourceBo : dataSourceBoList) {
        dataSourceList.add(tFDataSourceBoMapper.map(dataSourceBo));
    }
    TFDataSourceList tFDataSourceList = new TFDataSourceList();
    tFDataSourceList.setDataSourceList(dataSourceList);
    return tFDataSourceList;
}
Also used : TFDataSourceList(com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList) ArrayList(java.util.ArrayList) TFDataSource(com.navercorp.pinpoint.thrift.dto.flink.TFDataSource) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)

Aggregations

TFDataSource (com.navercorp.pinpoint.thrift.dto.flink.TFDataSource)8 TFDataSourceList (com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)3 JoinDataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)3 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)3 JoinDataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo)2 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)2 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)1 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)1