nvazquez commented on code in PR #12112:
URL: https://github.com/apache/cloudstack/pull/12112#discussion_r2556103636
##########
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 @Sinscerly - I have a question around the metrics using tags in which you
have modified the help text - if not mistaken the text won't be updated as the
modification will happen after invoking `item.toMetricsString()` so at this
line the previous help text will be displayed, is this correct?
--
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]