Search in sources :

Example 11 with DataSourceBo

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

the class DataSourceSamplerTest method assertEquals.

private void assertEquals(SampledDataSource sampledDataSource, List<DataSourceBo> dataSourceBoList) {
    int minActiveConnectionSize = Integer.MAX_VALUE;
    int maxActiveConnectionSize = Integer.MIN_VALUE;
    int sumActiveConnectionSize = 0;
    int minMaxConnectionSize = Integer.MAX_VALUE;
    int maxMaxConnectionSize = Integer.MIN_VALUE;
    int sumMaxConnectionSize = 0;
    for (DataSourceBo dataSourceBo : dataSourceBoList) {
        int activeConnectionSize = dataSourceBo.getActiveConnectionSize();
        if (activeConnectionSize < minActiveConnectionSize) {
            minActiveConnectionSize = activeConnectionSize;
        }
        if (activeConnectionSize > maxActiveConnectionSize) {
            maxActiveConnectionSize = activeConnectionSize;
        }
        sumActiveConnectionSize += activeConnectionSize;
        int maxConnectionSize = dataSourceBo.getMaxConnectionSize();
        if (maxConnectionSize < minMaxConnectionSize) {
            minMaxConnectionSize = maxConnectionSize;
        }
        if (maxConnectionSize > maxMaxConnectionSize) {
            maxMaxConnectionSize = maxConnectionSize;
        }
        sumMaxConnectionSize += maxConnectionSize;
    }
    Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getMinYVal().equals(minActiveConnectionSize));
    Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getMaxYVal().equals(maxActiveConnectionSize));
    Assert.assertTrue(sampledDataSource.getActiveConnectionSize().getSumYVal().equals(sumActiveConnectionSize));
    Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getMinYVal().equals(minMaxConnectionSize));
    Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getMaxYVal().equals(maxMaxConnectionSize));
    Assert.assertTrue(sampledDataSource.getMaxConnectionSize().getSumYVal().equals(sumMaxConnectionSize));
}
Also used : DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)

Example 12 with DataSourceBo

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

the class DataSourceChartGroupTest method createSampledDataSource.

private SampledDataSource createSampledDataSource(long timestamp, int maxConnectionSize) {
    int testObjectSize = RANDOM.nextInt(CREATE_TEST_OBJECT_MAX_SIZE) + 1;
    List<DataSourceBo> dataSourceBoList = DataSourceTestUtils.createDataSourceBoList(1, testObjectSize, maxConnectionSize);
    return sampler.sampleDataPoints(0, timestamp, dataSourceBoList, null);
}
Also used : DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) Point(com.navercorp.pinpoint.web.vo.chart.Point)

Example 13 with DataSourceBo

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

the class AgentStatMapper method map.

@Override
public AgentStatBo map(TAgentStat tAgentStat) {
    if (tAgentStat == null) {
        return null;
    }
    final String agentId = tAgentStat.getAgentId();
    final long startTimestamp = tAgentStat.getStartTimestamp();
    final long timestamp = tAgentStat.getTimestamp();
    AgentStatBo agentStatBo = new AgentStatBo();
    agentStatBo.setAgentId(agentId);
    // jvmGc
    if (tAgentStat.isSetGc()) {
        JvmGcBo jvmGcBo = this.jvmGcBoMapper.map(tAgentStat.getGc());
        setBaseData(jvmGcBo, agentId, startTimestamp, timestamp);
        agentStatBo.setJvmGcBos(Arrays.asList(jvmGcBo));
    }
    // jvmGcDetailed
    if (tAgentStat.isSetGc()) {
        if (tAgentStat.getGc().isSetJvmGcDetailed()) {
            JvmGcDetailedBo jvmGcDetailedBo = this.jvmGcDetailedBoMapper.map(tAgentStat.getGc().getJvmGcDetailed());
            setBaseData(jvmGcDetailedBo, agentId, startTimestamp, timestamp);
            agentStatBo.setJvmGcDetailedBos(Arrays.asList(jvmGcDetailedBo));
        }
    }
    // cpuLoad
    if (tAgentStat.isSetCpuLoad()) {
        CpuLoadBo cpuLoadBo = this.cpuLoadBoMapper.map(tAgentStat.getCpuLoad());
        setBaseData(cpuLoadBo, agentId, startTimestamp, timestamp);
        agentStatBo.setCpuLoadBos(Arrays.asList(cpuLoadBo));
    }
    // transaction
    if (tAgentStat.isSetTransaction()) {
        TransactionBo transactionBo = this.transactionBoMapper.map(tAgentStat.getTransaction());
        setBaseData(transactionBo, agentId, startTimestamp, timestamp);
        transactionBo.setCollectInterval(tAgentStat.getCollectInterval());
        agentStatBo.setTransactionBos(Arrays.asList(transactionBo));
    }
    // activeTrace
    if (tAgentStat.isSetActiveTrace() && tAgentStat.getActiveTrace().isSetHistogram()) {
        ActiveTraceBo activeTraceBo = this.activeTraceBoMapper.map(tAgentStat.getActiveTrace());
        setBaseData(activeTraceBo, agentId, startTimestamp, timestamp);
        agentStatBo.setActiveTraceBos(Arrays.asList(activeTraceBo));
    }
    // datasource
    if (tAgentStat.isSetDataSourceList()) {
        DataSourceListBo dataSourceListBo = new DataSourceListBo();
        setBaseData(dataSourceListBo, agentId, startTimestamp, timestamp);
        TDataSourceList dataSourceList = tAgentStat.getDataSourceList();
        for (TDataSource dataSource : dataSourceList.getDataSourceList()) {
            DataSourceBo dataSourceBo = dataSourceBoMapper.map(dataSource);
            setBaseData(dataSourceBo, agentId, startTimestamp, timestamp);
            dataSourceListBo.add(dataSourceBo);
        }
        agentStatBo.setDataSourceListBos(Arrays.asList(dataSourceListBo));
    }
    return agentStatBo;
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) CpuLoadBo(com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo) TDataSourceList(com.navercorp.pinpoint.thrift.dto.TDataSourceList) JvmGcDetailedBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) TransactionBo(com.navercorp.pinpoint.common.server.bo.stat.TransactionBo) TDataSource(com.navercorp.pinpoint.thrift.dto.TDataSource) ActiveTraceBo(com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)

Example 14 with DataSourceBo

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

the class DataSourceCodecV2 method encodeDataSourceListBo.

private void encodeDataSourceListBo(Buffer valueBuffer, DataSourceListBo dataSourceListBo) {
    final int numValues = dataSourceListBo.size();
    valueBuffer.putVInt(numValues);
    if (numValues == 0) {
        return;
    }
    // id                   // int
    // serviceTypeCode      // short
    // name                 // string
    // jdbcUrl              // string
    // activeConnectionSize //int
    // maxConnectionSize    // int
    List<Long> startTimestamps = new ArrayList<Long>(numValues);
    List<Long> timestamps = new ArrayList<Long>(numValues);
    UnsignedIntegerEncodingStrategy.Analyzer.Builder idAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder();
    UnsignedShortEncodingStrategy.Analyzer.Builder serviceTypeAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder();
    StringEncodingStrategy.Analyzer.Builder databaseNameAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder();
    StringEncodingStrategy.Analyzer.Builder jdbcUrlAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder();
    UnsignedIntegerEncodingStrategy.Analyzer.Builder activeConnectionSizeAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder();
    UnsignedIntegerEncodingStrategy.Analyzer.Builder maxConnectionSizeAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder();
    for (DataSourceBo dataSourceBo : dataSourceListBo.getList()) {
        startTimestamps.add(dataSourceBo.getStartTimestamp());
        timestamps.add(dataSourceBo.getTimestamp());
        idAnalyzerBuilder.addValue(dataSourceBo.getId());
        serviceTypeAnalyzerBuilder.addValue(dataSourceBo.getServiceTypeCode());
        databaseNameAnalyzerBuilder.addValue(dataSourceBo.getDatabaseName());
        jdbcUrlAnalyzerBuilder.addValue(dataSourceBo.getJdbcUrl());
        activeConnectionSizeAnalyzerBuilder.addValue(dataSourceBo.getActiveConnectionSize());
        maxConnectionSizeAnalyzerBuilder.addValue(dataSourceBo.getMaxConnectionSize());
    }
    this.codec.encodeValues(valueBuffer, UnsignedLongEncodingStrategy.REPEAT_COUNT, startTimestamps);
    this.codec.encodeTimestamps(valueBuffer, timestamps);
    this.encodeDataPoints(valueBuffer, idAnalyzerBuilder.build(), serviceTypeAnalyzerBuilder.build(), databaseNameAnalyzerBuilder.build(), jdbcUrlAnalyzerBuilder.build(), activeConnectionSizeAnalyzerBuilder.build(), maxConnectionSizeAnalyzerBuilder.build());
}
Also used : UnsignedIntegerEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy) ArrayList(java.util.ArrayList) StrategyAnalyzer(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) StringEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StringEncodingStrategy) UnsignedShortEncodingStrategy(com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy)

Example 15 with DataSourceBo

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

the class SampledDataSourceResultExtractor method divideByDataSourceId.

private Map<Integer, List<DataSourceBo>> divideByDataSourceId(ResultScanner results) throws Exception {
    int rowNum = 0;
    Map<Integer, List<DataSourceBo>> dataSourceBoListMap = new HashMap<>();
    for (Result result : results) {
        for (DataSourceListBo dataPoint : this.rowMapper.mapRow(result, rowNum++)) {
            if (dataPoint.size() == 0) {
                continue;
            }
            DataSourceBo first = ListUtils.getFirst(dataPoint.getList(), null);
            int id = first.getId();
            List<DataSourceBo> dataSourceBoList = dataSourceBoListMap.get(id);
            if (dataSourceBoList == null) {
                dataSourceBoList = new ArrayList<>();
                dataSourceBoListMap.put(id, dataSourceBoList);
            }
            dataSourceBoList.addAll(dataPoint.getList());
        }
    }
    return dataSourceBoListMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SampledDataSourceList(com.navercorp.pinpoint.web.vo.stat.SampledDataSourceList) List(java.util.List) DataSourceListBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) Result(org.apache.hadoop.hbase.client.Result)

Aggregations

DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)15 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)6 ArrayList (java.util.ArrayList)6 SampledDataSource (com.navercorp.pinpoint.web.vo.stat.SampledDataSource)3 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)2 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)2 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)2 JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)2 JvmGcDetailedBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo)2 TransactionBo (com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)2 TDataSource (com.navercorp.pinpoint.thrift.dto.TDataSource)2 TDataSourceList (com.navercorp.pinpoint.thrift.dto.TDataSourceList)2 Point (com.navercorp.pinpoint.web.vo.chart.Point)2 SampledDataSourceList (com.navercorp.pinpoint.web.vo.stat.SampledDataSourceList)2 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)1 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)1 StrategyAnalyzer (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer)1 StringEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StringEncodingStrategy)1 UnsignedIntegerEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy)1 UnsignedShortEncodingStrategy (com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy)1