Search in sources :

Example 1 with AgentUriStatBo

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

the class GrpcAgentStatHandlerV2 method handleAgentUriStat.

private void handleAgentUriStat(PAgentUriStat agentUriStat) {
    if (isDebug) {
        logger.debug("Handle PAgentUriStat={}", MessageFormatUtils.debugLog(agentUriStat));
    }
    final AgentUriStatBo agentUriStatBo = agentUriStatMapper.map(agentUriStat);
    agentUriStatService.save(agentUriStatBo);
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo)

Example 2 with AgentUriStatBo

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

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

the class SampledUriStatResultExtractor method divideByUri.

private Map<String, List<EachUriStatBo>> divideByUri(ResultScanner results) throws Exception {
    Map<String, List<EachUriStatBo>> eachUriStatBoListMap = new HashMap<>();
    int rowNum = 0;
    for (Result result : results) {
        for (AgentUriStatBo agentUriStatBo : this.rowMapper.mapRow(result, rowNum++)) {
            List<EachUriStatBo> eachUriStatBoList = agentUriStatBo.getEachUriStatBoList();
            if (CollectionUtils.isEmpty(eachUriStatBoList)) {
                continue;
            }
            final String agentId = agentUriStatBo.getAgentId();
            final long startTimestamp = agentUriStatBo.getStartTimestamp();
            final long timestamp = agentUriStatBo.getTimestamp();
            for (EachUriStatBo eachUriStatBo : eachUriStatBoList) {
                String uri = eachUriStatBo.getUri();
                List<EachUriStatBo> eachUriStatBos = eachUriStatBoListMap.computeIfAbsent(uri, k -> new ArrayList<>());
                setAgentStatDataPointBaseData(eachUriStatBo, agentId, startTimestamp, timestamp);
                eachUriStatBos.add(eachUriStatBo);
            }
        }
    }
    return eachUriStatBoListMap;
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) AgentStatDataPoint(com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint) Result(org.apache.hadoop.hbase.client.Result)

Example 4 with AgentUriStatBo

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

the class GrpcAgentUriStatMapper method map.

public AgentUriStatBo map(final PAgentUriStat agentUriStat) {
    final Header agentInfo = ServerContext.getAgentInfo();
    final String agentId = agentInfo.getAgentId();
    final long startTimestamp = agentInfo.getAgentStartTime();
    long timestamp = agentUriStat.getTimestamp();
    int bucketVersion = agentUriStat.getBucketVersion();
    AgentUriStatBo agentUriStatBo = new AgentUriStatBo();
    agentUriStatBo.setAgentId(agentId);
    agentUriStatBo.setStartTimestamp(startTimestamp);
    agentUriStatBo.setTimestamp(timestamp);
    agentUriStatBo.setBucketVersion((byte) bucketVersion);
    List<PEachUriStat> eachUriStatList = agentUriStat.getEachUriStatList();
    for (PEachUriStat pEachUriStat : eachUriStatList) {
        EachUriStatBo eachUriStatBo = createEachUriStatBo(pEachUriStat);
        agentUriStatBo.addEachUriStatBo(eachUriStatBo);
    }
    return agentUriStatBo;
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo) Header(com.navercorp.pinpoint.grpc.Header) PEachUriStat(com.navercorp.pinpoint.grpc.trace.PEachUriStat) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)

Example 5 with AgentUriStatBo

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

the class AgentUriStatCodecV2 method encodeValues.

@Override
public void encodeValues(Buffer valueBuffer, List<AgentUriStatBo> agentUriStatBoList) {
    final int numValues = CollectionUtils.nullSafeSize(agentUriStatBoList);
    if (numValues != 1) {
        return;
    }
    AgentUriStatBo agentUriStatBo = agentUriStatBoList.get(0);
    long startTimestamp = agentUriStatBo.getStartTimestamp();
    valueBuffer.putVLong(startTimestamp);
    long timestamp = agentUriStatBo.getTimestamp();
    valueBuffer.putVLong(timestamp);
    byte bucketVersion = agentUriStatBo.getBucketVersion();
    valueBuffer.putByte(bucketVersion);
    List<EachUriStatBo> eachUriStatBoList = agentUriStatBo.getEachUriStatBoList();
    int eachUriStatBoSize = CollectionUtils.nullSafeSize(eachUriStatBoList);
    valueBuffer.putVInt(eachUriStatBoSize);
    EachUriStatCodecV2 eachUriStatCodecV2 = new EachUriStatCodecV2(codec);
    eachUriStatCodecV2.encodeValues(valueBuffer, eachUriStatBoList);
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)

Aggregations

AgentUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo)6 EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)4 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)1 Header (com.navercorp.pinpoint.grpc.Header)1 PEachUriStat (com.navercorp.pinpoint.grpc.trace.PEachUriStat)1 SampledUriStatResultExtractor (com.navercorp.pinpoint.web.mapper.stat.SampledUriStatResultExtractor)1 Range (com.navercorp.pinpoint.web.vo.Range)1 SampledAgentUriStat (com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)1 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Result (org.apache.hadoop.hbase.client.Result)1