morningman commented on a change in pull request #6383:
URL: https://github.com/apache/incubator-doris/pull/6383#discussion_r684727197
##########
File path: fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java
##########
@@ -17,6 +17,8 @@
package org.apache.doris.metric;
+import java.util.ArrayList;
Review comment:
Thanks for your PR.
Please reorganize the import order, you can refer to
http://doris.incubator.apache.org/master/zh-CN/developer-guide/java-format-code.html#import-order
##########
File path:
fe/fe-core/src/main/java/org/apache/doris/metric/PrometheusMetricVisitor.java
##########
@@ -17,6 +17,8 @@
package org.apache.doris.metric;
+import java.util.HashSet;
Review comment:
import order
##########
File path: fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java
##########
@@ -492,7 +494,9 @@ public static synchronized String getMetric(MetricVisitor
visitor) {
visitor.setMetricNumber(PALO_METRIC_REGISTER.getPaloMetrics().size());
// doris metrics
- for (Metric metric : PALO_METRIC_REGISTER.getPaloMetrics()) {
+ List<Metric> paloMetrics = new
ArrayList<>(PALO_METRIC_REGISTER.getPaloMetrics());
+ paloMetrics.sort(Comparator.comparing(Metric::getName));
Review comment:
How about replacing the `paloMetrics` in PALO_METRIC_REGISTER to a
PriorityQueue, and the metric can be sorted when added.
So that we don't need to sort the metric every time we visit it.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]