Search in sources :

Example 1 with JoinDataSourceListBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo 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 2 with JoinDataSourceListBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo 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 3 with JoinDataSourceListBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo in project pinpoint by naver.

the class DataSourceCodec method decodeValues.

@Override
public List<JoinStatBo> decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) {
    final String id = decodingContext.getApplicationId();
    final long baseTimestamp = decodingContext.getBaseTimestamp();
    final long timestampDelta = decodingContext.getTimestampDelta();
    final long initialTimestamp = baseTimestamp + timestampDelta;
    int numValues = valueBuffer.readVInt();
    List<Long> timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
    List<JoinStatBo> joinDataSourceListBoList = new ArrayList<JoinStatBo>(numValues);
    for (int i = 0; i < numValues; ++i) {
        JoinDataSourceListBo joinDataSourceListBo = new JoinDataSourceListBo();
        joinDataSourceListBo.setId(id);
        joinDataSourceListBo.setTimestamp(timestampList.get(i));
        joinDataSourceListBo.setJoinDataSourceBoList(decodeJoinDataSourceBoList(valueBuffer));
        joinDataSourceListBoList.add(joinDataSourceListBo);
    }
    return joinDataSourceListBoList;
}
Also used : ArrayList(java.util.ArrayList) JoinStatBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)

Example 4 with JoinDataSourceListBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo in project pinpoint by naver.

the class JoinDataSourceSamplerTest method sampleDataPointsTest.

@Test
public void sampleDataPointsTest() {
    final String id = "test_app";
    JoinDataSourceSampler sampler = new JoinDataSourceSampler();
    long timestamp = new Date().getTime();
    AggreJoinDataSourceListBo aggreJoinDataSourceListBo = sampler.sampleDataPoints(0, timestamp, createJoinDataSourceListBoList(id, timestamp), new JoinDataSourceListBo());
    assertEquals(aggreJoinDataSourceListBo.getId(), id);
    assertEquals(aggreJoinDataSourceListBo.getTimestamp(), timestamp);
    List<AggreJoinDataSourceBo> joinDataSourceBoList = aggreJoinDataSourceListBo.getAggreJoinDataSourceBoList();
    joinDataSourceBoList.sort(COMPARATOR);
    assertEquals(joinDataSourceBoList.size(), 5);
    AggreJoinDataSourceBo aggreJoinDataSourceBo1 = joinDataSourceBoList.get(0);
    assertEquals(aggreJoinDataSourceBo1.getServiceTypeCode(), 1000);
    assertEquals(aggreJoinDataSourceBo1.getUrl(), "jdbc:mysql");
    assertEquals(aggreJoinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(60, 35, "agent_id_1_10", 110, "agent_id_6_50"));
    AggreJoinDataSourceBo aggreJoinDataSourceBo2 = joinDataSourceBoList.get(1);
    assertEquals(aggreJoinDataSourceBo2.getServiceTypeCode(), 2000);
    assertEquals(aggreJoinDataSourceBo2.getUrl(), "jdbc:mssql");
    assertEquals(aggreJoinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(50, 15, "agent_id_2_10", 80, "agent_id_7_50"));
    AggreJoinDataSourceBo aggreJoinDataSourceBo3 = joinDataSourceBoList.get(2);
    assertEquals(aggreJoinDataSourceBo3.getServiceTypeCode(), 3000);
    assertEquals(aggreJoinDataSourceBo3.getUrl(), "jdbc:postgre");
    assertEquals(aggreJoinDataSourceBo3.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(40, 35, "agent_id_3_10", 100, "agent_id_8_50"));
    AggreJoinDataSourceBo aggreJoinDataSourceBo4 = joinDataSourceBoList.get(3);
    assertEquals(aggreJoinDataSourceBo4.getServiceTypeCode(), 4000);
    assertEquals(aggreJoinDataSourceBo4.getUrl(), "jdbc:oracle");
    assertEquals(aggreJoinDataSourceBo4.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(70, 20, "agent_id_4_10", 120, "agent_id_9_50"));
    AggreJoinDataSourceBo aggreJoinDataSourceBo5 = joinDataSourceBoList.get(4);
    assertEquals(aggreJoinDataSourceBo5.getServiceTypeCode(), 5000);
    assertEquals(aggreJoinDataSourceBo5.getUrl(), "jdbc:cubrid");
    assertEquals(aggreJoinDataSourceBo5.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(80, 35, "agent_id_5_10", 130, "agent_id_10_50"));
}
Also used : JoinIntFieldBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo) AggreJoinDataSourceListBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo) AggreJoinDataSourceListBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo) AggreJoinDataSourceBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo) Date(java.util.Date) Test(org.junit.Test)

Example 5 with JoinDataSourceListBo

use of com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo in project pinpoint by naver.

the class JoinDataSourceSamplerTest method createJoinDataSourceListBoList.

private List<JoinDataSourceListBo> createJoinDataSourceListBoList(String id, long currentTime) {
    List<JoinDataSourceListBo> joinDataSourceListBoList = new ArrayList<JoinDataSourceListBo>();
    JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(10), currentTime + 5000);
    JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(20), currentTime + 10000);
    JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(30), currentTime + 15000);
    JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(40), currentTime + 20000);
    JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo(id, createJoinDataSourceBoList(50), currentTime + 25000);
    joinDataSourceListBoList.add(joinDataSourceListBo1);
    joinDataSourceListBoList.add(joinDataSourceListBo2);
    joinDataSourceListBoList.add(joinDataSourceListBo3);
    joinDataSourceListBoList.add(joinDataSourceListBo4);
    joinDataSourceListBoList.add(joinDataSourceListBo5);
    return joinDataSourceListBoList;
}
Also used : ArrayList(java.util.ArrayList) AggreJoinDataSourceListBo(com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo) JoinDataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)

Aggregations

JoinDataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo)10 ArrayList (java.util.ArrayList)7 JoinDataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo)3 JoinIntFieldBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo)3 TFDataSource (com.navercorp.pinpoint.thrift.dto.flink.TFDataSource)3 TFDataSourceList (com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList)3 AggreJoinDataSourceListBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo)3 Test (org.junit.Test)3 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)2 TFAgentStat (com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat)2 AggreJoinDataSourceBo (com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo)2 Date (java.util.Date)1