Search in sources :

Example 1 with UriStatHistogram

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

the class GrpcAgentUriStatMapper method createEachUriStatBo.

private EachUriStatBo createEachUriStatBo(PEachUriStat pEachUriStat) {
    EachUriStatBo eachUriStatBo = new EachUriStatBo();
    final String uri = pEachUriStat.getUri();
    eachUriStatBo.setUri(uri);
    PUriHistogram pTotalHistogram = pEachUriStat.getTotalHistogram();
    final UriStatHistogram totalHistogram = convertUriStatHistogram(pTotalHistogram);
    eachUriStatBo.setTotalHistogram(totalHistogram);
    PUriHistogram pFailedHistogram = pEachUriStat.getFailedHistogram();
    final UriStatHistogram failedHistogram = convertUriStatHistogram(pFailedHistogram);
    eachUriStatBo.setFailedHistogram(failedHistogram);
    return eachUriStatBo;
}
Also used : PUriHistogram(com.navercorp.pinpoint.grpc.trace.PUriHistogram) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)

Example 2 with UriStatHistogram

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

the class AgentUriStatSampler method sampleDataPoints.

@Override
public SampledEachUriStatBo sampleDataPoints(int index, long timestamp, List<EachUriStatBo> eachUriStatBoList, EachUriStatBo previousDataPoint) {
    if (CollectionUtils.isEmpty(eachUriStatBoList)) {
        return null;
    }
    final String uri = getUri(eachUriStatBoList);
    List<UriStatHistogram> totalUriStatHistogramList = eachUriStatBoList.stream().map(EachUriStatBo::getTotalHistogram).filter(Objects::nonNull).collect(Collectors.toList());
    SampledUriStatHistogramBo sampledTotalUriStatHistogramBo = create(timestamp, totalUriStatHistogramList);
    List<UriStatHistogram> failedUriStatHistogramList = eachUriStatBoList.stream().map(EachUriStatBo::getFailedHistogram).filter(Objects::nonNull).collect(Collectors.toList());
    SampledUriStatHistogramBo failedSampledUriStatHistogramBo = create(timestamp, failedUriStatHistogramList);
    SampledEachUriStatBo sampledEachUriStatBo = new SampledEachUriStatBo(uri, sampledTotalUriStatHistogramBo, failedSampledUriStatHistogramBo);
    return sampledEachUriStatBo;
}
Also used : SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) SampledUriStatHistogramBo(com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo) EachUriStatBo(com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo) SampledEachUriStatBo(com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo) UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)

Example 3 with UriStatHistogram

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

the class AgentUriStatSamplerTest method createUriStatHistogram.

private UriStatHistogram createUriStatHistogram(int count) {
    long totalElapsed = 0;
    long max = 0;
    int[] bucketValues = new int[UriStatHistogramBucket.getBucketSize()];
    for (int i = 0; i < count; i++) {
        int elapsed = ThreadLocalRandom.current().nextInt(10000);
        totalElapsed += elapsed;
        max = Math.max(max, elapsed);
        UriStatHistogramBucket bucket = UriStatHistogramBucket.getValue(elapsed);
        bucketValues[bucket.getIndex()] += 1;
    }
    UriStatHistogram uriStatHistogram = new UriStatHistogram();
    uriStatHistogram.setCount(count);
    uriStatHistogram.setAvg(totalElapsed / count);
    uriStatHistogram.setMax(max);
    uriStatHistogram.setTimestampHistogram(bucketValues);
    return uriStatHistogram;
}
Also used : UriStatHistogramBucket(com.navercorp.pinpoint.common.trace.UriStatHistogramBucket) AgentStatPoint(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint) UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)

Example 4 with UriStatHistogram

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

the class GrpcAgentUriStatMapper method convertUriStatHistogram.

private UriStatHistogram convertUriStatHistogram(PUriHistogram pUriHistogram) {
    int count = pUriHistogram.getCount();
    if (count == 0) {
        return null;
    }
    double avg = pUriHistogram.getAvg();
    long max = pUriHistogram.getMax();
    int histogramCount = pUriHistogram.getHistogramCount();
    List<Integer> histogramList = pUriHistogram.getHistogramList();
    int[] histogram = new int[histogramCount];
    for (int i = 0; i < histogramCount; i++) {
        histogram[i] = histogramList.get(i);
    }
    UriStatHistogram uriStatHistogram = new UriStatHistogram();
    uriStatHistogram.setCount(count);
    uriStatHistogram.setAvg(avg);
    uriStatHistogram.setMax(max);
    uriStatHistogram.setTimestampHistogram(histogram);
    return uriStatHistogram;
}
Also used : UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)

Example 5 with UriStatHistogram

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

the class AgentUriStatSampler method createHistogramBucketCountMap.

private Map<UriStatHistogramBucket, Integer> createHistogramBucketCountMap(List<UriStatHistogram> uriStatHistogramList) {
    int[] mergedHistogramValue = new int[UriStatHistogramBucket.getBucketSize()];
    for (UriStatHistogram uriStatHistogram : uriStatHistogramList) {
        int[] timestampHistogram = uriStatHistogram.getTimestampHistogram();
        for (int i = 0; i < mergedHistogramValue.length; i++) {
            mergedHistogramValue[i] += timestampHistogram[i];
        }
    }
    Map<UriStatHistogramBucket, Integer> uriStatHistogramBucketCountMap = new EnumMap<>(UriStatHistogramBucket.class);
    for (UriStatHistogramBucket value : BUCKETS) {
        int eachBucketTotalCount = mergedHistogramValue[value.getIndex()];
        uriStatHistogramBucketCountMap.put(value, eachBucketTotalCount);
    }
    return uriStatHistogramBucketCountMap;
}
Also used : UriStatHistogramBucket(com.navercorp.pinpoint.common.trace.UriStatHistogramBucket) EnumMap(java.util.EnumMap) UriStatHistogram(com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram) AgentStatPoint(com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)

Aggregations

UriStatHistogram (com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)5 EachUriStatBo (com.navercorp.pinpoint.common.server.bo.stat.EachUriStatBo)2 UriStatHistogramBucket (com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)2 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)2 PUriHistogram (com.navercorp.pinpoint.grpc.trace.PUriHistogram)1 SampledEachUriStatBo (com.navercorp.pinpoint.web.vo.stat.SampledEachUriStatBo)1 SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)1 EnumMap (java.util.EnumMap)1