nvazquez commented on code in PR #12112:
URL: https://github.com/apache/cloudstack/pull/12112#discussion_r2641090128


##########
plugins/integrations/prometheus/src/main/java/org/apache/cloudstack/metrics/PrometheusExporterImpl.java:
##########
@@ -512,20 +512,48 @@ public void updateMetrics() {
     public String getMetrics() {
         final StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.append("# Cloudstack Prometheus Metrics\n");
-        for (final Item item : metricsItems) {
+
+        List<Item> sortedItems = metricsItems.stream()
+            .sorted((item1, item2) -> item1.name.compareTo(item2.name))
+            .collect(Collectors.toList());
+
+        String currentMetricName = null;
+
+        for (Item item : sortedItems) {
+            if (!item.name.equals(currentMetricName)) {
+                currentMetricName = item.name;
+                stringBuilder.append("# HELP 
").append(currentMetricName).append(" ")
+                            .append(item.getHelp()).append("\n");

Review Comment:
   Thanks @Sinscerly please ignore my second comment then :) 
   
   About the first one, do you think that can be addressed on a separate PR, 
leaving this PR as it is now?



-- 
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]

Reply via email to