Search in sources :

Example 6 with EachUriStatBo

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

the class AgentUriStatSamplerTest method createEachUriStatBo.

private EachUriStatBo createEachUriStatBo(String agentId, long startTimestamp, long timestamp, String uri) {
    EachUriStatBo eachUriStatBo = new EachUriStatBo();
    eachUriStatBo.setAgentId(agentId);
    eachUriStatBo.setStartTimestamp(startTimestamp);
    eachUriStatBo.setTimestamp(timestamp);
    eachUriStatBo.setUri(uri);
    eachUriStatBo.setTotalHistogram(createUriStatHistogram(ThreadLocalRandom.current().nextInt(1, 10)));
    return eachUriStatBo;
}
Also used : EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)

Example 7 with EachUriStatBo

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

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

the class AgentUriStatSamplerTest method assertHistogramValue.

private void assertHistogramValue(int[] uriStatHistogramValue, List<EachUriStatBo> actual) {
    int[] newArrayValue = new int[UriStatHistogramBucket.getBucketSize()];
    for (EachUriStatBo eachUriStatBo : actual) {
        int[] timestampHistogram = eachUriStatBo.getTotalHistogram().getTimestampHistogram();
        for (int i = 0; i < timestampHistogram.length; i++) {
            newArrayValue[i] += timestampHistogram[i];
        }
    }
    Assert.assertTrue(Arrays.equals(uriStatHistogramValue, newArrayValue));
}
Also used : EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) AgentStatPoint(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)

Example 9 with EachUriStatBo

use of com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo 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)

Example 10 with EachUriStatBo

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

the class AgentUriStatCodecV2 method decodeValues.

@Override
public List<AgentUriStatBo> decodeValues(Buffer valueBuffer, AgentStatDecodingContext decodingContext) {
    AgentUriStatBo agentUriStatBo = new AgentUriStatBo();
    final String agentId = decodingContext.getAgentId();
    agentUriStatBo.setAgentId(agentId);
    final long startTimeStamp = valueBuffer.readVLong();
    agentUriStatBo.setStartTimestamp(startTimeStamp);
    final long timestamp = valueBuffer.readVLong();
    agentUriStatBo.setTimestamp(timestamp);
    final byte bucketVersion = valueBuffer.readByte();
    agentUriStatBo.setBucketVersion(bucketVersion);
    EachUriStatCodecV2 eachUriStatCodecV2 = new EachUriStatCodecV2(codec);
    List<EachUriStatBo> eachUriStatBoList = eachUriStatCodecV2.decodeValues(valueBuffer, decodingContext);
    agentUriStatBo.addAllEachUriStatBo(eachUriStatBoList);
    return Arrays.asList(agentUriStatBo);
}
Also used : AgentUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)

Aggregations

EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)12 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)6 AgentUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentUriStatBo)4 ArrayList (java.util.ArrayList)3 UriStatHistogram (com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)2 SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)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 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 PUriHistogram (com.navercorp.pinpoint.grpc.trace.PUriHistogram)1 EagerSamplingHandler (com.navercorp.pinpoint.web.mapper.stat.sampling.EagerSamplingHandler)1 SampledAgentUriStat (com.navercorp.pinpoint.web.vo.stat.SampledAgentUriStat)1 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Result (org.apache.hadoop.hbase.client.Result)1 Test (org.junit.Test)1