Search in sources :

Example 6 with UriStatHistogramBucket

use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket in project pinpoint by naver.

the class UriStatHistogramTest method assertScheme.

void assertScheme(Random random, UriStatHistogramBucket prev, UriStatHistogramBucket current, int expectedIndex) {
    long value = Math.abs(random.nextLong());
    value %= (current.getTo() - current.getFrom());
    if (prev != null) {
        value += prev.getTo();
    }
    UriStatHistogramBucket result = UriStatHistogramBucket.getValue(value);
    Assert.assertEquals(current, result);
    Assert.assertEquals(expectedIndex, result.getIndex());
}
Also used : UriStatHistogramBucket(com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)

Example 7 with UriStatHistogramBucket

use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket in project pinpoint by naver.

the class GrpcUriStatMessageConverterTest method assertData.

private void assertData(List<UriStatInfo> expected, PUriHistogram actual) {
    Assert.assertEquals(expected.size(), actual.getCount());
    Assert.assertEquals(getMax(expected), actual.getMax());
    Assert.assertEquals(new Double(getAvg(expected)).longValue(), new Double(actual.getAvg()).longValue());
    List<Integer> histogramList = actual.getHistogramList();
    for (int i = 0; i < histogramList.size(); i++) {
        UriStatHistogramBucket valueByIndex = UriStatHistogramBucket.getValueByIndex(i);
        int bucketCount = getBucketCount(expected, valueByIndex);
        Assert.assertEquals(new Integer(bucketCount), histogramList.get(i));
    }
}
Also used : UriStatHistogramBucket(com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)

Example 8 with UriStatHistogramBucket

use of com.navercorp.pinpoint.common.trace.UriStatHistogramBucket 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

UriStatHistogramBucket (com.navercorp.pinpoint.common.trace.UriStatHistogramBucket)8 AgentStatPoint (com.navercorp.pinpoint.web.vo.stat.chart.agent.AgentStatPoint)4 UriStatHistogram (com.navercorp.pinpoint.common.server.bo.stat.UriStatHistogram)2 SampledUriStatHistogramBo (com.navercorp.pinpoint.web.vo.stat.SampledUriStatHistogramBo)1 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1