ankitsinghal commented on a change in pull request #19: 
RATIS-549,RATIS-550,RATIS-552,RATIS-553 Metric Framework for Ratis
URL: https://github.com/apache/incubator-ratis/pull/19#discussion_r284035119
 
 

 ##########
 File path: 
ratis-metrics/src/main/java/org/apache/ratis/metrics/impl/RatisMetricsRegistry.java
 ##########
 @@ -0,0 +1,86 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.metrics.impl;
+
+import java.util.Optional;
+
+import com.codahale.metrics.JmxReporter;
+import org.apache.ratis.metrics.MetricRegistries;
+import org.apache.ratis.metrics.MetricRegistry;
+import org.apache.ratis.metrics.MetricRegistryInfo;
+import org.apache.ratis.metrics.dropwizard.DropwizardMetricRegistryAdaptor;
+
+public class RatisMetricsRegistry {
+  public final static String RATIS_LOG_WORKER_METRICS_DESC = "Ratis Log worker 
metrics";
+  public final static String RATIS_LOG_WORKER_METRICS_CONTEXT = 
"RaftLogWorker";
+  public static final String RATIS_LOG_SERVICE_METRICS_CONTEXT = 
"RatisLogService";
+  public static final String RATIS_LOG_SERVICE_METRICS_DESC = "Ratis log 
service metrics";
+  public static final String RATIS_LOG_SERVICE_META_DATA_METRICS_CONTEXT =
+      "RatisLogServiceMetaData";
+  public static final String RATIS_LOG_SERVICE_META_DATA_METRICS_DESC =
+      "Ratis log service metadata metrics";
+
+  static {
+    MetricRegistries.global().getMetricRegistries().forEach(
+        registry -> JmxReporter.forRegistry(new 
DropwizardMetricRegistryAdaptor(registry))
 
 Review comment:
   Yeah, this is just for illustration. Need to check how our adaptor adopts 
other reporters of dropwizard.
   
   We already have some kind of indirection by using listeners on metrics 
registry, where user can implement MetricRegistryListener and register them in 
metric registry to report metrics in their own way.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to