codelipenghui commented on code in PR #17041:
URL: https://github.com/apache/pulsar/pull/17041#discussion_r945700331


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/stats/MetadataStoreStats.java:
##########
@@ -24,41 +24,42 @@
 
 public final class MetadataStoreStats implements AutoCloseable {
     private static final double[] BUCKETS = new double[]{1, 3, 5, 10, 20, 50, 
100, 200, 500, 1000, 2000, 5000};
-    private static final String LABEL_NAME = "metadata_store_name";
+    private static final String LABEL_NAME = "name";
+    protected static final String PREFIX = "pulsar_metadata_store_";
 
     private static final Histogram GET_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_get_ops_latency", "-")
+            .build(PREFIX + "get_latency", "-")
             .unit("ms")
             .buckets(BUCKETS)
             .labelNames(LABEL_NAME)
             .register();
     private static final Histogram DEL_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_del_ops_latency", "-")
+            .build(PREFIX + "del_latency", "-")

Review Comment:
   I'm not very sure about this part. Just the first impression, using labels 
here will reduce the metrics name.
   Documentation will also be more concise.



##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/stats/MetadataStoreStats.java:
##########
@@ -24,41 +24,42 @@
 
 public final class MetadataStoreStats implements AutoCloseable {
     private static final double[] BUCKETS = new double[]{1, 3, 5, 10, 20, 50, 
100, 200, 500, 1000, 2000, 5000};
-    private static final String LABEL_NAME = "metadata_store_name";
+    private static final String LABEL_NAME = "name";
+    protected static final String PREFIX = "pulsar_metadata_store_";
 
     private static final Histogram GET_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_get_ops_latency", "-")
+            .build(PREFIX + "get_latency", "-")
             .unit("ms")
             .buckets(BUCKETS)
             .labelNames(LABEL_NAME)
             .register();
     private static final Histogram DEL_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_del_ops_latency", "-")
+            .build(PREFIX + "del_latency", "-")

Review Comment:
   I'm thinking how about adding operation type as a label?
   
   It looks like 
   
   pulsar_metadata_store_op_latency_ms{type="put/get/del"}
   pulsar_metadata_store_op_failed_total{type="put/get/del"}



##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/stats/MetadataStoreStats.java:
##########
@@ -24,41 +24,42 @@
 
 public final class MetadataStoreStats implements AutoCloseable {
     private static final double[] BUCKETS = new double[]{1, 3, 5, 10, 20, 50, 
100, 200, 500, 1000, 2000, 5000};
-    private static final String LABEL_NAME = "metadata_store_name";
+    private static final String LABEL_NAME = "name";
+    protected static final String PREFIX = "pulsar_metadata_store_";
 
     private static final Histogram GET_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_get_ops_latency", "-")
+            .build(PREFIX + "get_latency", "-")
             .unit("ms")
             .buckets(BUCKETS)
             .labelNames(LABEL_NAME)
             .register();
     private static final Histogram DEL_OPS_SUCCEED = Histogram
-            .build("pulsar_metadata_store_del_ops_latency", "-")
+            .build(PREFIX + "del_latency", "-")

Review Comment:
   I think unit "ms" will append _ms automatically?



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