Search in sources :

Example 1 with EagerSamplingHandler

use of com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler in project pinpoint by naver.

the class SampledDataSourceResultExtractor method getSampleData.

private SampledDataSourceList getSampleData(List<DataSourceBo> dataSourceBoList) {
    Collections.sort(dataSourceBoList, new Comparator<DataSourceBo>() {

        @Override
        public int compare(DataSourceBo o1, DataSourceBo o2) {
            return Long.compare(o2.getTimestamp(), o1.getTimestamp());
        }
    });
    AgentStatSamplingHandler<DataSourceBo, SampledDataSource> samplingHandler = new EagerSamplingHandler<>(timeWindow, sampler);
    for (DataSourceBo dataSourceBo : dataSourceBoList) {
        samplingHandler.addDataPoint(dataSourceBo);
    }
    List<SampledDataSource> sampledDataSources = samplingHandler.getSampledDataPoints();
    SampledDataSourceList sampledDataSourceList = new SampledDataSourceList();
    for (SampledDataSource sampledDataSource : sampledDataSources) {
        sampledDataSourceList.addSampledDataSource(sampledDataSource);
    }
    return sampledDataSourceList;
}
Also used : SampledDataSourceList(com.navercorp.pinpoint.web.vo.stat.SampledDataSourceList) SampledDataSource(com.navercorp.pinpoint.web.vo.stat.SampledDataSource) DataSourceBo(com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo) EagerSamplingHandler(com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler)

Example 2 with EagerSamplingHandler

use of com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler in project pinpoint by naver.

the class SampledAgentStatResultExtractor method extractData.

@Override
public List<S> extractData(ResultScanner results) throws Exception {
    int rowNum = 0;
    AgentStatSamplingHandler<T, S> samplingHandler = new EagerSamplingHandler<>(timeWindow, sampler);
    for (Result result : results) {
        for (T dataPoint : this.rowMapper.mapRow(result, rowNum++)) {
            samplingHandler.addDataPoint(dataPoint);
        }
    }
    return samplingHandler.getSampledDataPoints();
}
Also used : EagerSamplingHandler(com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler) AgentStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint) SampledAgentStatDataPoint(com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint) Result(org.apache.hadoop.hbase.client.Result)

Aggregations

EagerSamplingHandler (com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler)2 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)1 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)1 SampledAgentStatDataPoint (com.navercorp.pinpoint.web.vo.stat.SampledAgentStatDataPoint)1 SampledDataSource (com.navercorp.pinpoint.web.vo.stat.SampledDataSource)1 SampledDataSourceList (com.navercorp.pinpoint.web.vo.stat.SampledDataSourceList)1 Result (org.apache.hadoop.hbase.client.Result)1