Pengzna commented on code in PR #11410:
URL: https://github.com/apache/iotdb/pull/11410#discussion_r1375870082
##########
iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBRate.java:
##########
@@ -33,49 +34,50 @@
* <p>Now, we only record a gauge for the rate record in micrometer, and we
use dropwizard meter to
* calculate the meter.
*/
-public class MicrometerRate implements Rate {
- AtomicLong atomicLong;
+public class IoTDBRate extends AbstractJmxRateBean implements Rate,
IoTDBRateMBean {
Meter meter;
- public MicrometerRate(AtomicLong atomicLong) {
- this.atomicLong = atomicLong;
- this.meter = new Meter();
+ public IoTDBRate() {
+ this.meter = new Meter(new IoTDBMovingAverage(), Clock.defaultClock());
}
@Override
public long getCount() {
- return meter.getCount();
+ return this.count();
+ }
+
+ @Override
+ public double getMeanRate() {
+ return this.meanRate();
}
@Override
public double getOneMinuteRate() {
- return meter.getOneMinuteRate();
+ return this.oneMinuteRate();
}
@Override
- public double getMeanRate() {
- return meter.getMeanRate();
+ public long count() {
+ return meter.getCount();
}
@Override
- public double getFiveMinuteRate() {
- return meter.getFiveMinuteRate();
+ public double oneMinuteRate() {
+ return meter.getOneMinuteRate();
}
Review Comment:
Yes, we can.
Here I distinguish the getter method from the real work method because in
the original implementation of iotdb metric system, the methods' name did not
include 'get'. I wanted to keep it consistent with the original naming
convention. However, unifying the getter method and the real work method into
one method is indeed more elegant and concise, have fixed!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]