Search in sources :

Example 1 with SampledAgentUriStat

use of com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat in project pinpoint by naver.

the class HbaseSampledAgentUriStatDaoV2 method getSampledAgentStatList.

@Override
public List<SampledAgentUriStat> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
    long scanFrom = timeWindow.getWindowRange().getFrom();
    long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
    Range range = Range.newRange(scanFrom, scanTo);
    AgentStatMapperV2<AgentUriStatBo> mapper = operations.createRowMapper(agentUriStatDecoder, range);
    SampledUriStatResultExtractor resultExtractor = new SampledUriStatResultExtractor(timeWindow, mapper, agentUriStatSampler);
    List<SampledAgentUriStat> sampledAgentUriStatList = operations.getSampledAgentStatList(AgentStatType.URI, resultExtractor, agentId, range);
    return sampledAgentUriStatList;
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo) SampledUriStatResultExtractor(com.navercorp.pinpoint.web.mapper.stat.SampledUriStatResultExtractor) Range(com.navercorp.pinpoint.web.vo.Range) SampledAgentUriStat(com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)

Example 2 with SampledAgentUriStat

use of com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat in project pinpoint by naver.

the class AgentUriStatChartService method selectAgentChartList.

@Override
public List<StatChart> selectAgentChartList(String agentId, TimeWindow timeWindow) {
    Objects.requireNonNull(agentId, "agentId");
    Objects.requireNonNull(timeWindow, "timeWindow");
    List<SampledAgentUriStat> sampledAgentUriStatList = sampledAgentUriStatDao.getSampledAgentStatList(agentId, timeWindow);
    if (CollectionUtils.isEmpty(sampledAgentUriStatList)) {
        return Arrays.asList(new AgentUriStatChart(timeWindow, Collections.emptyList()));
    } else {
        List<StatChart> result = new ArrayList<>(sampledAgentUriStatList.size());
        for (SampledAgentUriStat sampledAgentUriStat : sampledAgentUriStatList) {
            result.add(new AgentUriStatChart(timeWindow, sampledAgentUriStat.getSampledEachUriStatBoList()));
        }
        Collections.sort(result, new Comparator<StatChart>() {

            @Override
            public int compare(StatChart o1, StatChart o2) {
                AgentUriStatChart chart1 = (AgentUriStatChart) o1;
                AgentUriStatChart chart2 = (AgentUriStatChart) o2;
                return Long.compare(chart2.getTotalCount(), chart1.getTotalCount());
            }
        });
        return result;
    }
}
Also used : ArrayList(java.util.ArrayList) AgentUriStatChart(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentUriStatChart) StatChart(com.navercorp.pinpoint.web.vo.stat.chart.StatChart) AgentUriStatChart(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentUriStatChart) SampledAgentUriStat(com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)

Example 3 with SampledAgentUriStat

use of com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat in project pinpoint by naver.

the class AgentUriStatChartService method selectAgentChart.

@Override
public StatChart selectAgentChart(String agentId, TimeWindow timeWindow) {
    Objects.requireNonNull(agentId, "agentId");
    Objects.requireNonNull(timeWindow, "timeWindow");
    List<SampledAgentUriStat> sampledAgentUriStatList = sampledAgentUriStatDao.getSampledAgentStatList(agentId, timeWindow);
    if (CollectionUtils.isEmpty(sampledAgentUriStatList)) {
        return new AgentUriStatChart(timeWindow, Collections.emptyList());
    } else {
        SampledAgentUriStat first = CollectionUtils.firstElement(sampledAgentUriStatList);
        return new AgentUriStatChart(timeWindow, first.getSampledEachUriStatBoList());
    }
}
Also used : AgentUriStatChart(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentUriStatChart) SampledAgentUriStat(com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)

Example 4 with SampledAgentUriStat

use of com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat in project pinpoint by naver.

the class SampledUriStatResultExtractor method getSampleData.

private SampledAgentUriStat getSampleData(List<EachUriStatBo> eachUriStatBos) {
    eachUriStatBos.sort(Comparator.comparingLong(EachUriStatBo::getTimestamp).reversed());
    AgentStatSamplingHandler<EachUriStatBo, SampledEachUriStatBo> samplingHandler = new EagerSamplingHandler<>(timeWindow, sampler);
    for (EachUriStatBo eachUriStatBo : eachUriStatBos) {
        samplingHandler.addDataPoint(eachUriStatBo);
    }
    List<SampledEachUriStatBo> sampledDataPoints = samplingHandler.getSampledDataPoints();
    SampledAgentUriStat sampledAgentUriStat = new SampledAgentUriStat(sampledDataPoints);
    return sampledAgentUriStat;
}
Also used : SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) EagerSamplingHandler(com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler) SampledAgentUriStat(com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)

Aggregations

SampledAgentUriStat (com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)4 AgentUriStatChart (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentUriStatChart)2 AgentUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo)1 EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)1 SampledUriStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledUriStatResultExtractor)1 EagerSamplingHandler (com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler)1 Range (com.navercorp.pinpoint.web.vo.Range)1 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)1 StatChart (com.navercorp.pinpoint.web.vo.stat.chart.StatChart)1 ArrayList (java.util.ArrayList)1