phoenix-dev mailing list archives

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

    https://github.com/apache/phoenix/pull/315#discussion_r207051474
  
    --- 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 don't have a strong opinion on how you expose this to let PQS say "I am PQS" (e.g. whether
CSV, list<string>, whatever).
    
    But yeah, modifying `snapshotAllMetrics` to include a Hadoop Metrics2 MetricsTag should
do the trick.


---

Mime
View raw message