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/12/08 04:58:33 UTC

[GitHub] [pulsar] michaeljmarshall commented on a change in pull request #13184: [Broker] Add admin api to get bundle stats

michaeljmarshall commented on a change in pull request #13184:
URL: https://github.com/apache/pulsar/pull/13184#discussion_r764544572



##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
##########
@@ -847,6 +847,26 @@ void run() throws PulsarAdminException {
         }
     }
 
+    @Parameters(commandDescription = "get bundle stats from namespace")

Review comment:
       Nit:
   ```suggestion
       @Parameters(commandDescription = "Get bundle stats for namespace")
   ```

##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/BundleStats.java
##########
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.common.policies.data;
+
+import java.util.List;
+import lombok.Data;
+
+@Data
+public class BundleStats {
+    public List<String> topics;
+
+    public String bundleName;
+    public double msgRateIn;
+    public double msgThroughputIn;
+    public double msgRateOut;
+    public double msgThroughputOut;
+    public int consumerCount;
+    public int producerCount;
+    public long topicCount;

Review comment:
       Nit: this field is `topics` in the `NamespaceBundleStats`. I think it is better to use `topicCount`, and I don't believe `NamespaceBundleStats` is used externally. So, I think this divergence is fine. However, I want to call this out for any others reviewing this PR.

##########
File path: pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
##########
@@ -847,6 +847,26 @@ void run() throws PulsarAdminException {
         }
     }
 
+    @Parameters(commandDescription = "get bundle stats from namespace")
+    private class BundleStats extends CliCommand {
+        @Parameter(description = "tenant/namespace", required = true)
+        private java.util.List<String> params;
+
+        @Parameter(names = { "--bundle", "-b" }, description = "{start-boundary}_{end-boundary}")

Review comment:
       It'd be nice to update the description to mention that omitting the field will get all bundle stats for the namespace. (I see that the other bundle commands don't have this note, but I still think it'd be helpful.)

##########
File path: pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Namespaces.java
##########
@@ -190,6 +191,14 @@
      */
     CompletableFuture<BundlesData> getBundlesAsync(String namespace);
 
+    BundleStats getBundleStats(String namespace, String bundle) throws PulsarAdminException;
+
+    CompletableFuture<BundleStats> getBundleStatsAsync(String namespace, String bundle);
+
+    List<BundleStats> getAllBundleStats(String namespace) throws PulsarAdminException;
+
+    CompletableFuture<List<BundleStats>> getAllBundleStatsAsync(String namespace);

Review comment:
       Please add Javadocs for these methods.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -1305,6 +1308,41 @@ protected DispatchRate internalGetSubscriptionDispatchRate() {
         return policies.subscriptionDispatchRate.get(pulsar().getConfiguration().getClusterName());
     }
 
+    public List<BundleStats> internalGetAllBundleStats() {

Review comment:
       Will this return stats for the bundles owned by this broker or will it return all bundle stats?




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