HBASE-27316 Time based metrics will be reset after any get request

Change-Id: I9a7a07b2cd0de298b868912306bba03cabe6b3ed
This commit is contained in:
fanyunbo 2022-08-23 16:19:44 +08:00
parent 950ad8dd3e
commit 0047b6e2c5
2 changed files with 10 additions and 2 deletions

View File

@ -312,8 +312,16 @@ public class FastLongHistogram {
* Resets the histogram for new counting.
*/
public Snapshot snapshotAndReset() {
final Bins oldBins = this.bins;
Snapshot snapshot = snapshot();
this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
return snapshot;
}
/**
* do snapshot without reset
*/
public Snapshot snapshot() {
final Bins oldBins = this.bins;
final long[] percentiles = oldBins.getQuantiles(DEFAULT_QUANTILES);
final long count = oldBins.count.sum();

View File

@ -78,7 +78,7 @@ public class HistogramImpl implements Histogram {
@Override
public Snapshot snapshot() {
return histogram.snapshotAndReset();
return histogram.snapshot();
}
public long[] getQuantiles(double[] quantiles) {