You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/12/09 05:56:44 UTC

[GitHub] [pulsar] 315157973 opened a new pull request #8871: Export Prometheus metric for messageTTL

315157973 opened a new pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871


   Fixes #8573
   
   ### Motivation
   Some users who want to know how many messages are expired at what time? Currently, these metrics are too few, so that TTL looks like a black box, unobservable
   
   ### Modifications
   add  `totalMsgExpired`、`lastExpireTimestamp`、`msgRateExpired` for Prometheus metric
   
   ### Verifying this change
   PrometheusMetricsTest.java


----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742224400


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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] [pulsar] sijie merged pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
sijie merged pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871


   


----------------------------------------------------------------
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] [pulsar] sijie commented on a change in pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#discussion_r539031499



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java
##########
@@ -185,6 +192,95 @@ public void testPerTopicStats() throws Exception {
         c2.close();
     }
 
+    @Test
+    public void testPerTopicExpiredStat() throws Exception {
+        String ns = "prop/ns-abc1";
+        admin.namespaces().createNamespace(ns);
+        String topic1 = "persistent://" + ns + "/testPerTopicExpiredStat1";
+        String topic2 = "persistent://" + ns + "/testPerTopicExpiredStat2";
+        List<String> topicList = Arrays.asList(topic2,topic1);
+        Producer<byte[]> p1 = pulsarClient.newProducer().topic(topic1).create();
+        Producer<byte[]> p2 = pulsarClient.newProducer().topic(topic2).create();
+        admin.namespaces().setNamespaceMessageTTL(ns,1);
+        final String subName = "test";
+        for (String topic : topicList) {
+            pulsarClient.newConsumer()
+                    .topic(topic)
+                    .subscriptionName(subName)
+                    .subscribe().close();
+        }
+
+        final int messages = 10;
+
+        for (int i = 0; i < messages; i++) {
+            String message = "my-message-" + i;
+            p1.send(message.getBytes());
+            p2.send(message.getBytes());
+        }
+
+        p1.close();
+        p2.close();
+        // make sure message is expired
+        Thread.sleep(2000);

Review comment:
       Can we find a different way to trigger message expiry task?
   
   It is not a good idea to call `Thread.sleep`.




----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-741884336


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742184145


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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] [pulsar] 315157973 removed a comment on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 removed a comment on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-741672698


   /pulsarbot run-failure-checks
   
   


----------------------------------------------------------------
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] [pulsar] 315157973 removed a comment on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 removed a comment on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742224400






----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742265050


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-741609484


   /pulsarbot run-failure-checks


----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-741672698


   /pulsarbot run-failure-checks
   
   


----------------------------------------------------------------
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] [pulsar] 315157973 commented on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742259687


   /pulsarbot run-failure-checks
   
   


----------------------------------------------------------------
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] [pulsar] 315157973 removed a comment on pull request #8871: Export Prometheus metric for messageTTL

Posted by GitBox <gi...@apache.org>.
315157973 removed a comment on pull request #8871:
URL: https://github.com/apache/pulsar/pull/8871#issuecomment-742259687


   /pulsarbot run-failure-checks
   
   


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