phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karanmehta93 <...@git.apache.org>
Subject [GitHub] phoenix pull request #315: PHOENIX-3655 Global Phoenix Client Metrics for PQ...
Date Wed, 01 Aug 2018 19:20:44 GMT
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/315#discussion_r207001759
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/monitoring/GlobalMetricRegistriesAdapter.java
---
    @@ -0,0 +1,167 @@
    +/*
    + * 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 java.util.Iterator;
    +import java.util.Map;
    +import java.util.Map.Entry;
    +import org.apache.commons.lang.StringUtils;
    +import org.apache.commons.logging.Log;
    +import org.apache.commons.logging.LogFactory;
    +import org.apache.hadoop.hbase.metrics.Counter;
    +import org.apache.hadoop.hbase.metrics.Gauge;
    +import org.apache.hadoop.hbase.metrics.Histogram;
    +import org.apache.hadoop.hbase.metrics.Meter;
    +import org.apache.hadoop.hbase.metrics.Metric;
    +import org.apache.hadoop.hbase.metrics.MetricRegistry;
    +import org.apache.hadoop.hbase.metrics.MetricRegistryInfo;
    +import org.apache.hadoop.hbase.metrics.Timer;
    +import org.apache.hadoop.metrics2.MetricsCollector;
    +import org.apache.hadoop.metrics2.MetricsInfo;
    +import org.apache.hadoop.metrics2.MetricsRecordBuilder;
    +import org.apache.hadoop.metrics2.MetricsSource;
    +import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
    +import org.apache.hadoop.metrics2.lib.Interns;
    +import org.apache.hadoop.metrics2.lib.MutableHistogram;
    +import org.apache.hadoop.metrics2.source.JvmMetrics;
    +
    +/**
    + * Contents mostly copied from GlobalMetricRegistriesAdapter class from hbase-hadoop2-compat
    + * The adapter attaches HBase's MetricRegistry to Hadoop's DefaultMetricsSystem
    + * Doesn't handle dynamic attach/detach of registries
    + */
    +public class GlobalMetricRegistriesAdapter {
    +
    +    private static final Log LOG = LogFactory.getLog(GlobalMetricRegistriesAdapter.class);
    +    private static GlobalMetricRegistriesAdapter INSTANCE;
    +
    +    private GlobalMetricRegistriesAdapter() {
    +        DefaultMetricsSystem.initialize("HBase");
    +        JvmMetrics.initSingleton("HBase", "");
    --- End diff --
    
    I am sorry, I didn't you on this one. Could you elaborate?
    Also, I realized that stopping JVM metrics from Phoenix Level is not an option here. Since
phoenix embeds hbase-client which instantiates JVM Metrics by default. Checkout this stack
trace. 
    
    
    `
    init:57, BaseSourceImpl$DefaultMetricsSystemInitializer (org.apache.hadoop.hbase.metrics)
    <init>:112, BaseSourceImpl (org.apache.hadoop.hbase.metrics)
    <init>:56, MetricsZooKeeperSourceImpl (org.apache.hadoop.hbase.zookeeper)
    <init>:51, MetricsZooKeeperSourceImpl (org.apache.hadoop.hbase.zookeeper)
    newInstance0:-1, NativeConstructorAccessorImpl (sun.reflect)
    newInstance:62, NativeConstructorAccessorImpl (sun.reflect)
    newInstance:45, DelegatingConstructorAccessorImpl (sun.reflect)
    newInstance:423, Constructor (java.lang.reflect)
    newInstance:442, Class (java.lang)
    nextService:380, ServiceLoader$LazyIterator (java.util)
    next:404, ServiceLoader$LazyIterator (java.util)
    next:480, ServiceLoader$1 (java.util)
    getInstance:59, CompatibilitySingletonFactory (org.apache.hadoop.hbase)
    <init>:38, MetricsZooKeeper (org.apache.hadoop.hbase.zookeeper)
    <init>:130, RecoverableZooKeeper (org.apache.hadoop.hbase.zookeeper)
    connect:143, ZKUtil (org.apache.hadoop.hbase.zookeeper)
    <init>:181, ZooKeeperWatcher (org.apache.hadoop.hbase.zookeeper)
    <init>:155, ZooKeeperWatcher (org.apache.hadoop.hbase.zookeeper)
    <init>:43, ZooKeeperKeepAliveConnection (org.apache.hadoop.hbase.client)
    getKeepAliveZooKeeperWatcher:1737, ConnectionManager$HConnectionImplementation (org.apache.hadoop.hbase.client)
    getClusterId:104, ZooKeeperRegistry (org.apache.hadoop.hbase.client)
    retrieveClusterId:945, ConnectionManager$HConnectionImplementation (org.apache.hadoop.hbase.client)
    <init>:721, ConnectionManager$HConnectionImplementation (org.apache.hadoop.hbase.client)
    newInstance0:-1, NativeConstructorAccessorImpl (sun.reflect)
    newInstance:62, NativeConstructorAccessorImpl (sun.reflect)
    newInstance:45, DelegatingConstructorAccessorImpl (sun.reflect)
    newInstance:423, Constructor (java.lang.reflect)
    createConnection:238, ConnectionFactory (org.apache.hadoop.hbase.client)
    createConnection:439, ConnectionManager (org.apache.hadoop.hbase.client)
    createConnectionInternal:348, ConnectionManager (org.apache.hadoop.hbase.client)
    createConnection:144, HConnectionManager (org.apache.hadoop.hbase.client)
    createConnection:47, HConnectionFactory$HConnectionFactoryImpl (org.apache.phoenix.query)
    openConnection:428, ConnectionQueryServicesImpl (org.apache.phoenix.query)
    access$400:270, ConnectionQueryServicesImpl (org.apache.phoenix.query)
    call:2539, ConnectionQueryServicesImpl$12 (org.apache.phoenix.query)
    call:2515, ConnectionQueryServicesImpl$12 (org.apache.phoenix.query)
    call:76, PhoenixContextExecutor (org.apache.phoenix.util)
    init:2515, ConnectionQueryServicesImpl (org.apache.phoenix.query)
    getConnectionQueryServices:255, PhoenixDriver (org.apache.phoenix.jdbc)
    createConnection:150, PhoenixEmbeddedDriver (org.apache.phoenix.jdbc)
    connect:221, PhoenixDriver (org.apache.phoenix.jdbc)
    getConnection:664, DriverManager (java.sql)
    getConnection:208, DriverManager (java.sql)
    createConnection:640, JdbcMeta (org.apache.calcite.avatica.jdbc)
    openConnection:625, JdbcMeta (org.apache.calcite.avatica.jdbc)
    apply:285, LocalService (org.apache.calcite.avatica.remote)
    accept:1770, Service$OpenConnectionRequest (org.apache.calcite.avatica.remote)
    accept:1750, Service$OpenConnectionRequest (org.apache.calcite.avatica.remote)
    apply:94, AbstractHandler (org.apache.calcite.avatica.remote)
    apply:46, ProtobufHandler (org.apache.calcite.avatica.remote)
    handle:127, AvaticaProtobufHandler (org.apache.calcite.avatica.server)
    handle:52, HandlerList (org.eclipse.jetty.server.handler)
    handle:97, HandlerWrapper (org.eclipse.jetty.server.handler)
    handle:499, Server (org.eclipse.jetty.server)
    handle:311, HttpChannel (org.eclipse.jetty.server)
    onFillable:257, HttpConnection (org.eclipse.jetty.server)
    run:544, AbstractConnection$2 (org.eclipse.jetty.io)
    runJob:635, QueuedThreadPool (org.eclipse.jetty.util.thread)
    run:555, QueuedThreadPool$3 (org.eclipse.jetty.util.thread)
    run:748, Thread (java.lang)
    `


---

Mime
View raw message