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 2021/05/06 16:42:42 UTC

[GitHub] [pulsar] megfigura opened a new issue #10495: msgDropRate metric is not available through non-deprecated Java interface, CLI, or Pulsar Manager

megfigura opened a new issue #10495:
URL: https://github.com/apache/pulsar/issues/10495


   **Describe the bug**
   https://github.com/apache/pulsar/pull/1634 consolidated the Admin API's `persistentTopics()` and `nonPersistentTopics()` to `topics(),` but the non-persistent _msgDropRate_ metric available in `nonPersistentTopics().stats()` is not available in the consolidated `topics().stats()`. Since `nonPersistentTopics()` is deprecated, so there is no supported API for getting _msgDropRate_. There is also no way to get this statistic from the `pulsar-admin` CLI tool or Pulsar Manager, presumably because they are using `topics().stats().`
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Create a non-persistent topic _nptopic_
   2. Use CLI tool: `pulsar-admin topics stats non-persistent://public/default/nptopic` -- _msgDropRate_ is not available
   3. Use Java client: `admin.topics().getStats(topic)` -- _msgDropRate_ is not available
   4. Use Java client: `admin.nonPersistentTopics().getStats(topic)` -- _msgDropRate_ **is** available, but this interface is deprecated
   
   **Expected behavior**
   This metric should be available through `topics().stats()`. OR a new method should be added to topics that returns non-persistent topic stats, similar to the `getPartitionedStats()` method that gets stats for partitioned topics.
   
   **Version**
   2.7.1


-- 
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] megfigura closed issue #10495: msgDropRate metric is not available through non-deprecated Java interface, CLI, or Pulsar Manager

Posted by GitBox <gi...@apache.org>.
megfigura closed issue #10495:
URL: https://github.com/apache/pulsar/issues/10495


   


-- 
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: commits-unsubscribe@pulsar.apache.org

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



[GitHub] [pulsar] MarvinCai commented on issue #10495: msgDropRate metric is not available through non-deprecated Java interface, CLI, or Pulsar Manager

Posted by GitBox <gi...@apache.org>.
MarvinCai commented on issue #10495:
URL: https://github.com/apache/pulsar/issues/10495#issuecomment-867742889


   the MsgDropRate is also missing from `stats` in mainline after the interface update, figure out it's a weird serialization issue, I'll try to fix it.


-- 
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] megfigura commented on issue #10495: msgDropRate metric is not available through non-deprecated Java interface, CLI, or Pulsar Manager

Posted by GitBox <gi...@apache.org>.
megfigura commented on issue #10495:
URL: https://github.com/apache/pulsar/issues/10495#issuecomment-915269613


   Thanks @MarvinCai,
   
   The new behavior in 2.8.1 is much better. At least as far as I can tell, it still requires a type cast, but that's not so bad. This code is working:
   ```java
   String topicName = "non-persistent://public/default/my_topic";
   TopicStats topicStats = admin.topics().getStats(topicName);
   SubscriptionStats subStats = stats.getSubscriptions().get("drop_test");
   double dropRate = 0.0;
   if (subStats instanceof NonPersistentSubscriptionStats)
   {
       NonPersistentSubscriptionStats npSubStats = (NonPersistentSubscriptionStats)subStats;
       dropRate = npSubStats.getMsgDropRate();
   }
   ```
   
   This beats my previous work-around in 2.7.1 (which no longer worked in 2.8.0):
   ```java
   String topicName = "non-persistent://public/default/my_topic";
   TopicStats topicStats;
   if (topicName.startsWith("non-persistent")
   {
       topicStats = admin.nonPersistentTopics().getStats(topicName);
   }
   else
   {
       topicStats = admin.topics().getStats(topicName);
   }
   
   double dropRate = 0.0;
   if (topicStats instanceof NonPersistentTopicStats)
   {
       NonPersistentTopicStats npTopicStats = (NonPersistentTopicStats)topicStats;
       dropRate = npTopicStats.getSubscriptions().get("drop_test").getMsgDropRate();
   }
   ```


-- 
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: commits-unsubscribe@pulsar.apache.org

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