You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/23 18:01:46 UTC

[GitHub] [incubator-pinot] mcvsubbu commented on a change in pull request #6579: Decouple from yammer library

mcvsubbu commented on a change in pull request #6579:
URL: https://github.com/apache/incubator-pinot/pull/6579#discussion_r581255886



##########
File path: pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
##########
@@ -0,0 +1,97 @@
+/**
+ * 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.pinot.common.metrics;
+
+import java.util.function.Function;
+import org.apache.pinot.common.exception.InvalidConfigException;
+import org.apache.pinot.spi.metrics.PinotGauge;
+import org.apache.pinot.spi.metrics.PinotJmxReporter;
+import org.apache.pinot.spi.metrics.PinotMetricName;
+import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import org.apache.pinot.common.metrics.yammer.YammerGauge;
+import org.apache.pinot.common.metrics.yammer.YammerJmxReporter;
+import org.apache.pinot.common.metrics.yammer.YammerMetricName;
+import org.apache.pinot.common.metrics.yammer.YammerMetricsRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class PinotMetricUtils {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PinotMetricUtils.class);
+  public static final String LIBRARY_NAME_KEY = "libraryName";
+  public static final String YAMMER_KEY = "yammer";
+
+  public static String LIBRARY_TO_USE = YAMMER_KEY;

Review comment:
       why is this public?

##########
File path: pinot-connectors/pinot-spark-connector/src/main/scala/org/apache/pinot/connector/spark/connector/PinotServerDataFetcher.scala
##########
@@ -45,7 +44,7 @@ private[pinot] class PinotServerDataFetcher(
   extends Logging {
   private val sqlCompiler = new CalciteSqlCompiler()
   private val brokerId = "apache_spark"
-  private val metricsRegistry = new MetricsRegistry()
+  private val metricsRegistry = PinotMetricUtils.getPinotMetricsRegistry

Review comment:
       Missing `()`?

##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricProcessor.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.pinot.spi.metrics;
+
+
+public interface PinotMetricProcessor<T> {

Review comment:
       Can you add some comments in front of this class stating how it is supposed to be used? And/or add some comments in front of each method stating what `process()` means. Thanks

##########
File path: pinot-common/src/main/java/org/apache/pinot/common/metrics/PinotMetricUtils.java
##########
@@ -0,0 +1,97 @@
+/**
+ * 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.pinot.common.metrics;
+
+import java.util.function.Function;
+import org.apache.pinot.common.exception.InvalidConfigException;
+import org.apache.pinot.spi.metrics.PinotGauge;
+import org.apache.pinot.spi.metrics.PinotJmxReporter;
+import org.apache.pinot.spi.metrics.PinotMetricName;
+import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import org.apache.pinot.common.metrics.yammer.YammerGauge;
+import org.apache.pinot.common.metrics.yammer.YammerJmxReporter;
+import org.apache.pinot.common.metrics.yammer.YammerMetricName;
+import org.apache.pinot.common.metrics.yammer.YammerMetricsRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class PinotMetricUtils {
+  private static final Logger LOGGER = LoggerFactory.getLogger(PinotMetricUtils.class);
+  public static final String LIBRARY_NAME_KEY = "libraryName";
+  public static final String YAMMER_KEY = "yammer";
+
+  public static String LIBRARY_TO_USE = YAMMER_KEY;
+
+  public static void init(String libraryName)

Review comment:
       Why not pass metrics configuration as an argument?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org