michaeljmarshall commented on code in PR #13785:
URL: https://github.com/apache/pulsar/pull/13785#discussion_r915450940


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGeneratorUtils.java:
##########
@@ -59,7 +59,7 @@ public static void 
generateSystemMetrics(SimpleTextOutputStream stream, String c
             Collector.MetricFamilySamples metricFamily = 
metricFamilySamples.nextElement();
 
             // Write type of metric
-            stream.write("# TYPE ").write(metricFamily.name).write(' ')
+            stream.write("# TYPE ").write(metricFamily.name + 
getTypeNameSuffix(metricFamily.type)).write(' ')

Review Comment:
   I think we might want to use the following:
   
   ```suggestion
               stream.write("# TYPE 
").write(metricFamily.name).write(getTypeNameSuffix(metricFamily.type)).write(' 
')
   ```



##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGeneratorUtils.java:
##########
@@ -88,19 +88,27 @@ public static void 
generateSystemMetrics(SimpleTextOutputStream stream, String c
         }
     }
 
+    static String getTypeNameSuffix(Collector.Type type) {
+        if (type.equals(Collector.Type.INFO)) {
+            return "_info";
+        }
+        return "";

Review Comment:
   This might be a premature optimization, but the `stream.write` method 
accepts null values, so it might be better not to create the empty string here.
   
   ```suggestion
           return null;
   ```



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