You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/05/24 13:44:29 UTC

[GitHub] [bookkeeper] hangc0276 opened a new pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

hangc0276 opened a new pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718


   ### Motivation
   After add label for prometheus metric by https://github.com/apache/bookkeeper/pull/2650, it will cause prometheus metric format check failed when no label specified for a statsLogger. The metric list as follow.
   ```
   replication_bookkeeper_client_bookkeeper_client_bookie_watcher_NEW_ENSEMBLE_TIME{success="false",quantile="0.9999", } NaN
   ```
   
   ### Modification
   1. add label empty check for `PrometheusTextFormatUtil`
   2. add label scope check test cover
   3. add prometheus metric regex pattern check in test case


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on a change in pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
dlg99 commented on a change in pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#discussion_r638064498



##########
File path: bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/PrometheusTextFormatUtil.java
##########
@@ -139,25 +139,34 @@ private static void writeQuantile(Writer w, DataSketchesOpStatsLogger opStat, St
         w.append(name)
                 .append("{success=\"").append(success.toString())
                 .append("\",quantile=\"").append(Double.toString(quantile))
-                .append("\", ");
-        writeLabelsNoBraces(w, opStat.getLabels());
+                .append("\"");
+        if (!opStat.getLabels().isEmpty()) {

Review comment:
       is it guaranteed that opStat.getLabels() is never 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli commented on pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#issuecomment-847524112


   Unfortunately 4.14.0 is already completed.
   
   Probably we must cut a 4.14.1 release
   
   @dlg99 ?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] hangc0276 commented on pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#issuecomment-847417542


   Whether we need to include this PR in 4.14.0 release before Pulsar 2.8.0 release?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] merlimat merged pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] hangc0276 commented on a change in pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on a change in pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#discussion_r638335331



##########
File path: bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/PrometheusTextFormatUtil.java
##########
@@ -139,25 +139,34 @@ private static void writeQuantile(Writer w, DataSketchesOpStatsLogger opStat, St
         w.append(name)
                 .append("{success=\"").append(success.toString())
                 .append("\",quantile=\"").append(Double.toString(quantile))
-                .append("\", ");
-        writeLabelsNoBraces(w, opStat.getLabels());
+                .append("\"");
+        if (!opStat.getLabels().isEmpty()) {

Review comment:
       ```Java
   // PrometheusMetricsProvider.java
   public StatsLogger getStatsLogger(String scope) {
           return new PrometheusStatsLogger(PrometheusMetricsProvider.this, scope, Collections.emptyMap());
       }
   
   // PrometheusStatsLogger.java
   PrometheusStatsLogger(PrometheusMetricsProvider provider, String scope, Map<String, String> labels) {
           this.provider = provider;
           this.scope = scope;
           this.labels = labels;
       }
   
   @Override
   public OpStatsLogger getOpStatsLogger(String name) {
       return provider.opStats.computeIfAbsent(scopeContext(name), x -> new DataSketchesOpStatsLogger(labels));
   }
   ```
   Yes, it will use `Collections.emptyMap()` to init labels when there are no labels.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] addisonj commented on pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
addisonj commented on pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#issuecomment-847072816


   Lgtm


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] merlimat commented on a change in pull request #2718: fix prometheus metric provider bug and add test to cover label scope …

Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #2718:
URL: https://github.com/apache/bookkeeper/pull/2718#discussion_r638203968



##########
File path: bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/prometheus/PrometheusTextFormatUtil.java
##########
@@ -139,25 +139,34 @@ private static void writeQuantile(Writer w, DataSketchesOpStatsLogger opStat, St
         w.append(name)
                 .append("{success=\"").append(success.toString())
                 .append("\",quantile=\"").append(Double.toString(quantile))
-                .append("\", ");
-        writeLabelsNoBraces(w, opStat.getLabels());
+                .append("\"");
+        if (!opStat.getLabels().isEmpty()) {

Review comment:
       Yes, it will return an empty map when there are no labels.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org