bshashikant commented on a change in pull request #159:
URL: https://github.com/apache/incubator-ratis/pull/159#discussion_r462895943



##########
File path: 
ratis-grpc/src/main/java/org/apache/ratis/grpc/metrics/MessageMetrics.java
##########
@@ -0,0 +1,51 @@
+/**
+ * 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.ratis.grpc.metrics;
+
+import org.apache.ratis.metrics.MetricRegistryInfo;
+import org.apache.ratis.metrics.RatisMetrics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MessageMetrics extends RatisMetrics {
+  static final Logger LOG = LoggerFactory.getLogger(MessageMetrics.class);
+  public static final String GRPC_MESSAGE_METRICS = "%s_message_metrics";
+  public static final String GRPC_MESSAGE_METRICS_DESC = "Outbound/Inbound 
message counters";
+
+  public MessageMetrics(String endpointId, String endpointType) {
+    this.registry = create(
+        new MetricRegistryInfo(endpointId,
+            RATIS_APPLICATION_NAME_METRICS,
+            String.format(GRPC_MESSAGE_METRICS, endpointType),
+            GRPC_MESSAGE_METRICS_DESC)
+    );
+  }
+
+  public void rpcStarted(String rpcType){
+    registry.counter(rpcType + "_started_total").inc();
+  }
+
+  public void rpcCompleted(String rpcType){
+    registry.counter(rpcType + "_completed_total").inc();
+  }
+
+  public void rpcHandled(String rpcType){

Review comment:
       why do we need 2 different counters one for rpc handled and one more rpc 
completed? Can you add some details?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to