Jackie-Jiang commented on code in PR #9701:
URL: https://github.com/apache/pinot/pull/9701#discussion_r1010849620


##########
pinot-common/src/main/java/org/apache/pinot/common/version/PinotVersion.java:
##########
@@ -45,6 +45,16 @@ private PinotVersion() {
     // private constructor for utility class
   }
 
+  /**
+   * Returns a sanitized version string with all dots replaced with 
underscores, which is necessary
+   * for Prometheus to be able to properly handle the version.
+   *
+   * @return the version in a way that can be indexed by prometheus
+   */
+  public static String getVersionMetricName() {
+    return VERSION.replace('.', '_').replace('-', '_');

Review Comment:
   Make a constant for `VERSION_METRIC_NAME` to avoid string manipulation per 
invocation



##########
docker/images/pinot/etc/jmx_prometheus_javaagent/configs/minion.yml:
##########
@@ -6,4 +6,9 @@ rules:
   name: "pinot_minion_$2_$3"
   cache: true
   labels:
-    id: "$1"
\ No newline at end of file
+    id: "$1"
+- pattern: "\"org.apache.pinot.common.metrics\"<type=\"MinionMetrics\", 
name=\"pinot.minion.version.(\\w+)\"><>(\\w+)"
+  name: "pinot_minion_version"
+  cache: true
+  labels:
+    version: "$1"

Review Comment:
   (nit) Add empty line in the end



##########
docker/images/pinot/etc/jmx_prometheus_javaagent/configs/server.yml:
##########
@@ -117,4 +117,9 @@ rules:
   labels:
     table: "$1"
     tableType: "$2"
-    partition: "$3"
\ No newline at end of file
+    partition: "$3"
+- pattern: "\"org.apache.pinot.common.metrics\"<type=\"ServerMetrics\", 
name=\"pinot.server.version.(\\w+)\"><>(\\w+)"
+  name: "pinot_server_version"
+  cache: true
+  labels:
+    version: "$1"

Review Comment:
   (nit) Add empty line in the end



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

Reply via email to