diff --git a/s3stream/src/main/java/com/automq/stream/s3/metrics/wrapper/DeltaHistogram.java b/s3stream/src/main/java/com/automq/stream/s3/metrics/wrapper/DeltaHistogram.java index 18a0ae2703..fca5f181e9 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/metrics/wrapper/DeltaHistogram.java +++ b/s3stream/src/main/java/com/automq/stream/s3/metrics/wrapper/DeltaHistogram.java @@ -132,7 +132,7 @@ public double p50() { return lastSnapshot.p50; } - private void snapshotAndReset() { + public SnapshotExt snapshotAndReset() { synchronized (this) { if (lastSnapshot == null || System.currentTimeMillis() - lastSnapshotTime > snapshotInterval) { this.intervalHistogram = this.recorder.getIntervalHistogram(this.intervalHistogram); @@ -159,9 +159,11 @@ private void snapshotAndReset() { lastSnapshotTime = System.currentTimeMillis(); } } + + return lastSnapshot; } - static class SnapshotExt { + public static class SnapshotExt { final long min; final long max; final long count; @@ -180,12 +182,40 @@ public SnapshotExt(long min, long max, long count, long sum, double p99, double this.p95 = p95; } - double mean() { + public double mean() { if (count == 0) { return 0; } else { return (double) sum / count; } } + + public long getMin() { + return min; + } + + public long getMax() { + return max; + } + + public long getCount() { + return count; + } + + public long getSum() { + return sum; + } + + public double getP99() { + return p99; + } + + public double getP95() { + return p95; + } + + public double getP50() { + return p50; + } } }