yanxinyi commented on a change in pull request #1224:
URL: https://github.com/apache/phoenix/pull/1224#discussion_r631458168



##########
File path: 
phoenix-core/src/main/java/org/apache/phoenix/monitoring/JmxMetricProvider.java
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.phoenix.monitoring;
+
+import org.apache.hadoop.hbase.metrics.Gauge;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.hadoop.hbase.metrics.MetricRegistries;
+import org.apache.hadoop.hbase.metrics.MetricRegistry;
+import org.apache.hadoop.hbase.metrics.MetricRegistryInfo;
+
+import java.util.Map;
+
+/**
+ * This class implements the JMX based default Metric publishing
+ * of Metrics to JMX end point.
+ * This class is defined in 
phoenix/phoenix-core/src/main/resources/META-INF/services/org.apache.phoenix.monitoring.MetricPublisherSupplierFactory
+ */
+public class JmxMetricProvider implements MetricPublisherSupplierFactory {
+
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(JmxMetricProvider.class);
+    private MetricRegistry metricRegistry;
+
+    @Override public void registerMetricProvider() {
+        metricRegistry = createMetricRegistry();
+        
GlobalMetricRegistriesAdapter.getInstance().registerMetricRegistry(metricRegistry);
+    }
+
+    @Override public void unregisterMetricProvider() {
+
+    }
+
+    private  MetricRegistry createMetricRegistry() {
+        LOGGER.info("Creating Metric Registry for Phoenix Table Level 
Metrics");
+        MetricRegistryInfo
+                registryInfo =
+                new MetricRegistryInfo("PHOENIX-TableLevel", "Phoenix Client 
Metrics",
+                        "phoenixTableLevel", "Phoenix,sub=CLIENT", true);

Review comment:
       please do not hardcode the string




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


Reply via email to