private void getValue2Map(Map<String, Long> keyValMap,
            boolean snapShot, boolean includeZero) {
        long p99Cnt = 0L;
        long p999Cnt = 0L;
        long p9999Cnt = 0L;
        int maxValIndex = -1;
        int match99Index = 0;
        int match999Index = 0;
        int match9999Index = 0;
        long curCnt;
        long maxValue;
        long minValue;
        if (snapShot) {
            curCnt = this.count.getAndResetValue();
            maxValue = this.max.getAndResetValue();
            minValue = this.min.getAndResetValue();
        } else {
            curCnt = this.count.getValue();
            maxValue = this.max.getValue();
            minValue = this.min.getValue();
        }
        if (curCnt > 0) {
            p99Cnt = (long) (curCnt * 0.99);
            p999Cnt = (long) (curCnt * 0.999);
            p9999Cnt = (long) (curCnt * 0.9999);
        }
        // put key and value
        keyValMap.put(this.count.getFullName(), curCnt);
        keyValMap.put(this.min.getFullName(), minValue);
        keyValMap.put(this.max.getFullName(), maxValue);
        long bucketItemVal;
        for (int i = 0; i < NUM_BUCKETS; i++) {
            bucketItemVal = snapShot
                    ? this.buckets[i].getAndResetValue()
                    : this.buckets[i].getValue();
            if (bucketItemVal == 0) {
                if (includeZero) {
                    keyValMap.put(this.buckets[i].getFullName(), bucketItemVal);
                }
            } else {
                keyValMap.put(this.buckets[i].getFullName(), bucketItemVal);
                maxValIndex = i;
                // calculate p99 value
                if (p99Cnt > 0) {
                    p99Cnt -= bucketItemVal;
                    if (p99Cnt <= 0) {
                        match99Index = i;
                    }
                }
                // calculate p999 value
                if (p999Cnt > 0) {
                    p999Cnt -= bucketItemVal;
                    if (p999Cnt <= 0) {
                        match999Index = i;
                    }
                }
                // calculate p9999 value
                if (p9999Cnt > 0) {
                    p9999Cnt -= bucketItemVal;
                    if (p9999Cnt <= 0) {
                        match9999Index = i;
                    }
                }
            }
        }
        keyValMap.put(p99FullKey,
                getPxValue(match99Index, maxValIndex, maxValue));
        keyValMap.put(p999FullKey,
                getPxValue(match999Index, maxValIndex, maxValue));
        keyValMap.put(p9999FullKey,
                getPxValue(match9999Index, maxValIndex, maxValue));
    }
Initial Exponential Statistics for Time Histogram

@param metricName   metric name
@param prefix       the prefix of metric item
inlong-tubemq/tubemq-core/src/main/java/org/apache/inlong/tubemq/corebase/metric/impl/ESTHistogram.java