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


##########
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:
   Hi @nvazquez,
   
   The HELP and TYPE only have to be added before each group of metrics. Only 
once for `cloudstack_domain_resource_count`, regardless of how many items with 
different tags share that metric name.
   
   Does this clarify your question?



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