Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-24615

MutableRangeHistogram#updateSnapshotRangeMetrics doesn't calculate the distribution for last bucket.

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      We are not processing the distribution for last bucket.

      https://github.com/apache/hbase/blob/master/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableRangeHistogram.java#L70

        public void updateSnapshotRangeMetrics(MetricsRecordBuilder metricsRecordBuilder,
                                               Snapshot snapshot) {
          long priorRange = 0;
          long cumNum = 0;
      
          final long[] ranges = getRanges();
          final String rangeType = getRangeType();
          for (int i = 0; i < ranges.length - 1; i++) {         -----> The bug lies here. We are not processing last bucket.
            long val = snapshot.getCountAtOrBelow(ranges[i]);
            if (val - cumNum > 0) {
              metricsRecordBuilder.addCounter(
                  Interns.info(name + "_" + rangeType + "_" + priorRange + "-" + ranges[i], desc),
                  val - cumNum);
            }
            priorRange = ranges[i];
            cumNum = val;
          }
          long val = snapshot.getCount();
          if (val - cumNum > 0) {
            metricsRecordBuilder.addCounter(
                Interns.info(name + "_" + rangeType + "_" + ranges[ranges.length - 1] + "-inf", desc),
                val - cumNum);
          }
        }
      

      Attachments

        Activity

          People

            wenfeiyi666 wenfeiyi666
            shahrs87 Rushabh Shah
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: