Pengzna commented on code in PR #11410:
URL: https://github.com/apache/iotdb/pull/11410#discussion_r1375845228
##########
iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBHistogram.java:
##########
@@ -17,19 +17,50 @@
* under the License.
*/
-package org.apache.iotdb.metrics.micrometer.type;
+package org.apache.iotdb.metrics.core.type;
+import
org.apache.iotdb.metrics.core.type.IoTDBHistogramMBean.AbstractJmxHistogramBean;
import org.apache.iotdb.metrics.type.Histogram;
-public class MicrometerHistogram implements Histogram {
+public class IoTDBHistogram extends AbstractJmxHistogramBean
+ implements Histogram, IoTDBHistogramMBean {
io.micrometer.core.instrument.DistributionSummary distributionSummary;
- public MicrometerHistogram(
- io.micrometer.core.instrument.DistributionSummary distributionSummary) {
+ public IoTDBHistogram(io.micrometer.core.instrument.DistributionSummary
distributionSummary) {
this.distributionSummary = distributionSummary;
}
+ @Override
+ public long getCount() {
+ return this.count();
+ }
+
+ @Override
+ public double getMax() {
Review Comment:
Good point! 👏
1. Only JmxReporter was going to use it.
2. As for the optimization you have mentioned, I actually hava considered
this problem. In fact, in order to ensure accuracy, we have to create a new
snapshot object every time the JMX calls `getXXX()` functions. Nonetheless, I
don't think this will cause too much of a performance problem because GC will
recycle those useless snapshot objects for us. What's your opinion?
##########
iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBHistogram.java:
##########
@@ -17,19 +17,50 @@
* under the License.
*/
-package org.apache.iotdb.metrics.micrometer.type;
+package org.apache.iotdb.metrics.core.type;
+import
org.apache.iotdb.metrics.core.type.IoTDBHistogramMBean.AbstractJmxHistogramBean;
import org.apache.iotdb.metrics.type.Histogram;
-public class MicrometerHistogram implements Histogram {
+public class IoTDBHistogram extends AbstractJmxHistogramBean
+ implements Histogram, IoTDBHistogramMBean {
io.micrometer.core.instrument.DistributionSummary distributionSummary;
- public MicrometerHistogram(
- io.micrometer.core.instrument.DistributionSummary distributionSummary) {
+ public IoTDBHistogram(io.micrometer.core.instrument.DistributionSummary
distributionSummary) {
this.distributionSummary = distributionSummary;
}
+ @Override
+ public long getCount() {
+ return this.count();
+ }
+
+ @Override
+ public double getMax() {
Review Comment:
Good point! 👏
1. Only JmxReporter was going to use it.
2. As for the optimization you have mentioned, I actually hava considered
this problem. In fact, in order to ensure accuracy, we have to create a new
snapshot object every time the JMX calls `getXXX()` functions. Nonetheless, I
don't think this will cause too much of a performance problem because GC will
recycle those useless snapshot objects for us. What's your opinion?
--
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]