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 2022/10/24 09:55:46 UTC

[GitHub] [pulsar] asafm commented on a diff in pull request #17072: [monitor][broker][metadata] add metrics for BatchMetadataStore

asafm commented on code in PR #17072:
URL: https://github.com/apache/pulsar/pull/17072#discussion_r1003118889


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/stats/BatchMetadataStoreStats.java:
##########
@@ -0,0 +1,128 @@
+/**
+ * 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.metadata.impl.stats;
+
+import io.prometheus.client.Counter;
+import io.prometheus.client.Gauge;
+import io.prometheus.client.Histogram;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.pulsar.metadata.impl.batching.MetadataOp;
+import org.jctools.queues.MessagePassingQueue;
+
+public final class BatchMetadataStoreStats implements AutoCloseable {
+    private static final double[] BUCKETS = new double[]{1, 5, 10, 20, 50, 100, 200, 500, 1000};
+    private static final String NAME = "name";
+    private static final String TYPE = "type";
+    private static final String OP_READ = "read";
+    private static final String OP_WRITE = "write";
+
+    private static final Gauge QUEUEING_OPS = Gauge
+            .build("pulsar_batch_metadata_store_queueing_ops", "-")
+            .labelNames(NAME, TYPE)
+            .register();
+    private static final Gauge EXECUTOR_QUEUE_SIZE = Gauge

Review Comment:
   It's ok, yet it doesn't tell you how long it has been in max - maybe only for a fraction of a second? 
   
   If I'm the operator here - what do I want to know?
   1. Do I need more threads? I know this if there is a large queue, or I cap the queue and I keep hitting the limits
   2. Am I allocating too many threads? I think this is less of an issue.
   
   So for (1) the most common thing is to use a Summary since we can know in advance the buckets for this.
   Max can also be ok since if you see max = capacity many times, you need to increase 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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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