This is an automated email from the ASF dual-hosted git repository.

gortiz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new f251f00182 Compound metric plugin
f251f00182 is described below

commit f251f00182a75dd79f2a7388546e92fb2a1658e6
Author: Gonzalo Ortiz Jaureguizar <gor...@users.noreply.github.com>
AuthorDate: Thu Oct 24 08:48:49 2024 +0200

    Compound metric plugin
    
    Create a new metric plugin called compound. This metric plugin contains a 
list of other metric plugins. Each time a metric is registered or unregistered 
in the compound registry, it is registered or unregistered in all other metric 
plugins. The metric plugins that are notified by the compound registry can be 
configured, but by default it notifies all other metric plugins in the 
classpath.
---
 .../pom.xml                                        |  39 ++--
 .../compound/AbstractCompoundPinotMetric.java}     |  31 ++-
 .../metrics/compound/CompoundPinotCounter.java}    |  20 +-
 .../metrics/compound/CompoundPinotGauge.java}      |  34 ++-
 .../metrics/compound/CompoundPinotHistogram.java}  |  20 +-
 .../compound/CompoundPinotJmxReporter.java}        |  18 +-
 .../metrics/compound/CompoundPinotMeter.java       |  84 ++++++++
 .../metrics/compound/CompoundPinotMetricName.java  |  61 ++++++
 .../compound/CompoundPinotMetricRegistry.java      | 143 +++++++++++++
 .../compound/CompoundPinotMetricsFactory.java      | 234 +++++++++++++++++++++
 .../metrics/compound/CompoundPinotTimer.java       |  82 ++++++++
 .../pinot-metrics/pinot-dropwizard/pom.xml         |   4 +
 .../metrics/dropwizard/DropwizardJmxReporter.java  |   6 +-
 .../dropwizard/DropwizardMetricsFactory.java       |   9 +-
 pinot-plugins/pinot-metrics/pinot-yammer/pom.xml   |   4 +
 .../metrics/yammer/YammerMetricsFactory.java       |   2 +
 pinot-plugins/pinot-metrics/pom.xml                |   1 +
 .../apache/pinot/spi/metrics/PinotMetricUtils.java |   2 +-
 .../apache/pinot/spi/utils/CommonConstants.java    |   2 +
 pinot-tools/pom.xml                                |  10 +-
 pom.xml                                            |   5 +
 21 files changed, 733 insertions(+), 78 deletions(-)

diff --git a/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/pom.xml
similarity index 64%
copy from pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml
copy to pinot-plugins/pinot-metrics/pinot-compound-metrics/pom.xml
index 1f6b389aa1..9260fe2638 100644
--- a/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml
+++ b/pinot-plugins/pinot-metrics/pinot-compound-metrics/pom.xml
@@ -19,48 +19,51 @@
     under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <artifactId>pinot-metrics</artifactId>
     <groupId>org.apache.pinot</groupId>
     <version>1.3.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
   </parent>
 
-  <artifactId>pinot-dropwizard</artifactId>
-  <name>Pinot Dropwizard Metrics</name>
+  <artifactId>pinot-compound-metrics</artifactId>
+  <name>Pinot Compound Metrics</name>
   <url>https://pinot.apache.org/</url>
   <properties>
     <pinot.root>${basedir}/../../..</pinot.root>
-    <shade.phase.prop>package</shade.phase.prop>
+    <phase.prop>package</phase.prop>
   </properties>
 
   <build>
     <plugins>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-assembly-plugin</artifactId>
+        <artifactId>maven-enforcer-plugin</artifactId>
       </plugin>
     </plugins>
   </build>
 
   <dependencies>
     <dependency>
-      <groupId>io.dropwizard.metrics</groupId>
-      <artifactId>metrics-core</artifactId>
+      <groupId>org.apache.pinot</groupId>
+      <artifactId>pinot-spi</artifactId>
     </dependency>
     <dependency>
-      <groupId>io.dropwizard.metrics</groupId>
-      <artifactId>metrics-jmx</artifactId>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service-annotations</artifactId>
     </dependency>
   </dependencies>
-
-  <profiles>
-    <profile>
-      <id>pinot-fastdev</id>
-      <properties>
-        <shade.phase.prop>none</shade.phase.prop>
-      </properties>
-    </profile>
-  </profiles>
 </project>
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/AbstractCompoundPinotMetric.java
similarity index 52%
copy from 
pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
copy to 
pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/AbstractCompoundPinotMetric.java
index 40114dc5f4..5618a476a6 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/AbstractCompoundPinotMetric.java
@@ -16,23 +16,32 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.plugin.metrics.dropwizard;
+package org.apache.pinot.plugin.metrics.compound;
 
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.jmx.JmxReporter;
-import org.apache.pinot.spi.metrics.PinotJmxReporter;
-import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import com.google.common.base.Preconditions;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.pinot.spi.metrics.PinotMetric;
 
 
-public class DropwizardJmxReporter implements PinotJmxReporter {
-  private final JmxReporter _jmxReporter;
+public abstract class AbstractCompoundPinotMetric<M extends PinotMetric> 
implements PinotMetric {
+  protected final List<M> _metrics;
 
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+  public AbstractCompoundPinotMetric(List<M> metrics) {
+    Preconditions.checkArgument(!metrics.isEmpty(), "At least one meter is 
needed");
+    _metrics = metrics;
   }
 
   @Override
-  public void start() {
-    _jmxReporter.start();
+  public Object getMetric() {
+    return 
_metrics.stream().map(PinotMetric::getMetric).collect(Collectors.toList());
+  }
+
+  protected M getSomeMeter() {
+    return _metrics.get(0);
+  }
+
+  public M getMeter(int index) {
+    return _metrics.get(index);
   }
 }
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotCounter.java
similarity index 58%
copy from 
pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
copy to 
pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotCounter.java
index 40114dc5f4..fc382de200 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotCounter.java
@@ -16,23 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.plugin.metrics.dropwizard;
+package org.apache.pinot.plugin.metrics.compound;
 
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.jmx.JmxReporter;
-import org.apache.pinot.spi.metrics.PinotJmxReporter;
-import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import java.util.List;
+import org.apache.pinot.spi.metrics.PinotCounter;
 
 
-public class DropwizardJmxReporter implements PinotJmxReporter {
-  private final JmxReporter _jmxReporter;
-
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+public class CompoundPinotCounter extends 
AbstractCompoundPinotMetric<PinotCounter> implements PinotCounter {
+  public CompoundPinotCounter(List<PinotCounter> metrics) {
+    super(metrics);
   }
 
   @Override
-  public void start() {
-    _jmxReporter.start();
+  public Object getCounter() {
+    return getSomeMeter().getCounter();
   }
 }
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotGauge.java
similarity index 53%
copy from 
pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
copy to 
pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotGauge.java
index 40114dc5f4..26137952a9 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotGauge.java
@@ -16,23 +16,35 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.plugin.metrics.dropwizard;
+package org.apache.pinot.plugin.metrics.compound;
 
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.jmx.JmxReporter;
-import org.apache.pinot.spi.metrics.PinotJmxReporter;
-import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import java.util.List;
+import java.util.function.Supplier;
+import org.apache.pinot.spi.metrics.PinotGauge;
 
 
-public class DropwizardJmxReporter implements PinotJmxReporter {
-  private final JmxReporter _jmxReporter;
+public class CompoundPinotGauge<T> extends 
AbstractCompoundPinotMetric<PinotGauge<T>> implements PinotGauge<T> {
+  public CompoundPinotGauge(List<PinotGauge<T>> meters) {
+    super(meters);
+  }
+
+  @Override
+  public Object getGauge() {
+    return getSomeMeter().getGauge();
+  }
 
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+  @Override
+  public T value() {
+    return getSomeMeter().value();
+  }
+
+  @Override
+  public void setValue(T value) {
+    _metrics.forEach(m -> m.setValue(value));
   }
 
   @Override
-  public void start() {
-    _jmxReporter.start();
+  public void setValueSupplier(Supplier<T> valueSupplier) {
+    _metrics.forEach(m -> m.setValueSupplier(valueSupplier));
   }
 }
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotHistogram.java
similarity index 58%
copy from 
pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
copy to 
pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotHistogram.java
index 40114dc5f4..4da8bc5203 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotHistogram.java
@@ -16,23 +16,19 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.plugin.metrics.dropwizard;
+package org.apache.pinot.plugin.metrics.compound;
 
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.jmx.JmxReporter;
-import org.apache.pinot.spi.metrics.PinotJmxReporter;
-import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import java.util.List;
+import org.apache.pinot.spi.metrics.PinotHistogram;
 
 
-public class DropwizardJmxReporter implements PinotJmxReporter {
-  private final JmxReporter _jmxReporter;
-
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+public class CompoundPinotHistogram extends 
AbstractCompoundPinotMetric<PinotHistogram> implements PinotHistogram {
+  public CompoundPinotHistogram(List<PinotHistogram> metrics) {
+    super(metrics);
   }
 
   @Override
-  public void start() {
-    _jmxReporter.start();
+  public Object getHistogram() {
+    return getMetric();
   }
 }
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotJmxReporter.java
similarity index 64%
copy from 
pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
copy to 
pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotJmxReporter.java
index 40114dc5f4..a7b6f032a1 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotJmxReporter.java
@@ -16,23 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.pinot.plugin.metrics.dropwizard;
+package org.apache.pinot.plugin.metrics.compound;
 
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.jmx.JmxReporter;
+import java.util.List;
 import org.apache.pinot.spi.metrics.PinotJmxReporter;
-import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
 
 
-public class DropwizardJmxReporter implements PinotJmxReporter {
-  private final JmxReporter _jmxReporter;
+public class CompoundPinotJmxReporter implements PinotJmxReporter {
+  private final List<PinotJmxReporter> _reporters;
 
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+  public CompoundPinotJmxReporter(List<PinotJmxReporter> reporters) {
+    _reporters = reporters;
   }
 
   @Override
   public void start() {
-    _jmxReporter.start();
+    for (PinotJmxReporter reporter : _reporters) {
+      reporter.start();
+    }
   }
 }
diff --git 
a/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMeter.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMeter.java
new file mode 100644
index 0000000000..4491e740c9
--- /dev/null
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMeter.java
@@ -0,0 +1,84 @@
+/**
+ * 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.plugin.metrics.compound;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import org.apache.pinot.spi.metrics.PinotMeter;
+
+
+public class CompoundPinotMeter extends 
AbstractCompoundPinotMetric<PinotMeter> implements PinotMeter {
+  public CompoundPinotMeter(List<PinotMeter> meters) {
+    super(meters);
+  }
+
+  @Override
+  public void mark() {
+    for (PinotMeter meter : _metrics) {
+      meter.mark();
+    }
+  }
+
+  @Override
+  public void mark(long unitCount) {
+    for (PinotMeter meter : _metrics) {
+      meter.mark(unitCount);
+    }
+  }
+
+  @Override
+  public long count() {
+    return getSomeMeter().count();
+  }
+
+  @Override
+  public Object getMetered() {
+    return getSomeMeter().getMetered();
+  }
+
+  @Override
+  public TimeUnit rateUnit() {
+    return getSomeMeter().rateUnit();
+  }
+
+  @Override
+  public String eventType() {
+    return getSomeMeter().eventType();
+  }
+
+  @Override
+  public double fifteenMinuteRate() {
+    return getSomeMeter().fifteenMinuteRate();
+  }
+
+  @Override
+  public double fiveMinuteRate() {
+    return getSomeMeter().fiveMinuteRate();
+  }
+
+  @Override
+  public double meanRate() {
+    return getSomeMeter().meanRate();
+  }
+
+  @Override
+  public double oneMinuteRate() {
+    return getSomeMeter().oneMinuteRate();
+  }
+}
diff --git 
a/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricName.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricName.java
new file mode 100644
index 0000000000..5fa4fecdff
--- /dev/null
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricName.java
@@ -0,0 +1,61 @@
+/**
+ * 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.plugin.metrics.compound;
+
+import java.util.List;
+import java.util.Objects;
+import org.apache.pinot.spi.metrics.PinotMetricName;
+
+
+public class CompoundPinotMetricName implements PinotMetricName {
+  private final String _toString;
+  private final List<PinotMetricName> _names;
+
+  public CompoundPinotMetricName(String toString, List<PinotMetricName> names) 
{
+    _toString = toString;
+    _names = names;
+  }
+
+  @Override
+  public String toString() {
+    return _toString;
+  }
+
+  @Override
+  public List<PinotMetricName> getMetricName() {
+    return _names;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    CompoundPinotMetricName that = (CompoundPinotMetricName) o;
+    return Objects.equals(_names, that._names);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(_names);
+  }
+}
diff --git 
a/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricRegistry.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricRegistry.java
new file mode 100644
index 0000000000..debcb173e2
--- /dev/null
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricRegistry.java
@@ -0,0 +1,143 @@
+/**
+ * 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.plugin.metrics.compound;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import org.apache.pinot.spi.metrics.PinotCounter;
+import org.apache.pinot.spi.metrics.PinotGauge;
+import org.apache.pinot.spi.metrics.PinotHistogram;
+import org.apache.pinot.spi.metrics.PinotMeter;
+import org.apache.pinot.spi.metrics.PinotMetric;
+import org.apache.pinot.spi.metrics.PinotMetricName;
+import org.apache.pinot.spi.metrics.PinotMetricUtils;
+import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import org.apache.pinot.spi.metrics.PinotMetricsRegistryListener;
+import org.apache.pinot.spi.metrics.PinotTimer;
+
+
+public class CompoundPinotMetricRegistry implements PinotMetricsRegistry {
+  private final List<PinotMetricsRegistry> _registries;
+  private final ConcurrentHashMap<PinotMetricName, PinotMetric> _allMetrics;
+
+  public CompoundPinotMetricRegistry(List<PinotMetricsRegistry> registries) {
+    _registries = registries;
+    _allMetrics = new ConcurrentHashMap<>();
+  }
+
+  @Override
+  public void removeMetric(PinotMetricName name) {
+    CompoundPinotMetricName castedName = (CompoundPinotMetricName) name;
+    _allMetrics.remove(name);
+    for (int i = 0; i < _registries.size(); i++) {
+      _registries.get(i).removeMetric(castedName.getMetricName().get(i));
+    }
+  }
+
+  private <T> List<T> map(PinotMetricName name, 
BiFunction<PinotMetricsRegistry, PinotMetricName, T> mapFun) {
+    CompoundPinotMetricName castedName = (CompoundPinotMetricName) name;
+    ArrayList<T> result = new ArrayList<>(_registries.size());
+    for (int i = 0; i < _registries.size(); i++) {
+      PinotMetricName metricName = castedName.getMetricName().get(i);
+      T mappedElement = mapFun.apply(_registries.get(i), metricName);
+      result.add(mappedElement);
+    }
+    return result;
+  }
+
+  @Override
+  public <T> PinotGauge<T> newGauge(PinotMetricName name, PinotGauge<T> gauge) 
{
+    if (gauge == null) {
+      return (PinotGauge<T>) _allMetrics.computeIfAbsent(name,
+          key -> new CompoundPinotGauge<>(map(key, (reg, subName) -> 
reg.newGauge(subName, null))));
+    } else {
+      CompoundPinotGauge<T> compoundGauge =
+          (CompoundPinotGauge<T>) PinotMetricUtils.makePinotGauge(avoid -> 
gauge.value());
+
+      Function<PinotMetricName, CompoundPinotGauge<?>> creator = key -> {
+        CompoundPinotMetricName compoundName = (CompoundPinotMetricName) key;
+        ArrayList<PinotGauge<T>> gauges = new ArrayList<>(_registries.size());
+        for (int i = 0; i < _registries.size(); i++) {
+          PinotGauge<?> subGauge = compoundGauge.getMeter(i);
+          PinotMetricName subName = compoundName.getMetricName().get(i);
+          PinotGauge<T> created = (PinotGauge<T>) 
_registries.get(i).newGauge(subName, subGauge);
+          gauges.add(created);
+        }
+        return new CompoundPinotGauge<>(gauges);
+      };
+
+      return (PinotGauge<T>) _allMetrics.computeIfAbsent(name, creator);
+    }
+  }
+
+  @Override
+  public PinotMeter newMeter(PinotMetricName name, String eventType, TimeUnit 
unit) {
+    return (PinotMeter) _allMetrics.computeIfAbsent(name,
+        key -> new CompoundPinotMeter(map(key, (reg, subName) -> 
reg.newMeter(subName, eventType, unit))));
+  }
+
+  @Override
+  public PinotCounter newCounter(PinotMetricName name) {
+    return (PinotCounter) _allMetrics.computeIfAbsent(name,
+        key -> new CompoundPinotCounter(map(key, 
PinotMetricsRegistry::newCounter)));
+  }
+
+  @Override
+  public PinotTimer newTimer(PinotMetricName name, TimeUnit durationUnit, 
TimeUnit rateUnit) {
+    return (PinotTimer) _allMetrics.computeIfAbsent(name,
+        key -> new CompoundPinotTimer(map(key, (reg, subName) -> 
reg.newTimer(subName, durationUnit, rateUnit))));
+  }
+
+  @Override
+  public PinotHistogram newHistogram(PinotMetricName name, boolean biased) {
+    return (PinotHistogram) _allMetrics.computeIfAbsent(name,
+        key -> new CompoundPinotHistogram(map(key, (reg, subName) -> 
reg.newHistogram(subName, biased))));
+  }
+
+  @Override
+  public Map<PinotMetricName, PinotMetric> allMetrics() {
+    return _allMetrics;
+  }
+
+  @Override
+  public void addListener(PinotMetricsRegistryListener listener) {
+    throw new UnsupportedOperationException("Not implemented yet");
+  }
+
+  @Override
+  public Object getMetricsRegistry() {
+    return this;
+  }
+
+  @Override
+  public void shutdown() {
+    for (PinotMetricsRegistry registry : _registries) {
+      registry.shutdown();
+    }
+  }
+
+  List<PinotMetricsRegistry> getRegistries() {
+    return _registries;
+  }
+}
diff --git 
a/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricsFactory.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricsFactory.java
new file mode 100644
index 0000000000..fe1b19e62b
--- /dev/null
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotMetricsFactory.java
@@ -0,0 +1,234 @@
+/**
+ * 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.plugin.metrics.compound;
+
+import com.google.auto.service.AutoService;
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.pinot.spi.annotations.metrics.MetricsFactory;
+import org.apache.pinot.spi.annotations.metrics.PinotMetricsFactory;
+import org.apache.pinot.spi.env.PinotConfiguration;
+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.PinotMetricUtils;
+import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
+import org.apache.pinot.spi.plugin.PluginManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is a special {@link PinotMetricsRegistry} that actually reports 
metrics in one or more registries. For example,
+ * it can be used to register metrics using both Yammer and Dropwizard. The 
way this class works is quite naive.
+ * When it is created, a bunch of factories are used as sub-factories. 
Whenever a metric is registered in this factory,
+ * it actually registers the metric in all the sub-factories.
+ *
+ * Probably the main reason to use this metrics is to compare the differences 
between one metric registry and another.
+ * For example, Yammer and Dropwizard provide their own timer, but each one 
provides their own metrics on their timers.
+ * Most metrics are the same (p50, p90, p95, etc) but some other may be 
different.
+ *
+ * Alternative it could be used in production, but it is important to make 
sure that the JMX MBeans produced by each
+ * sub-registry are different. Otherwise the reported value is undetermined.
+ *
+ * In order to use this factory, you have to set the following properties in 
Pinot configuration:
+ * <ol>
+ *   <li>pinot.&lt;server|broker|minion|etc&gt;.metrics.factory.className 
should be set to
+ *   org.apache.pinot.plugin.metrics.compound.CompoundPinotMetricsFactory</li>
+ *   <li>(optional) 
pinot.&lt;server|broker|minion|etc&gt;.metrics.compound.algorithm should be set 
to SERVICE_LOADER,
+ *   CLASSPATH or LIST. CLASSPATH is the default.</li>
+ *   <li>(optional) 
pinot.&lt;server|broker|minion|etc&gt;.metrics.compound.ignored can be used to 
ignore specific
+ *   metric registries</li>
+ * </ol>
+ */
+@AutoService(PinotMetricsFactory.class)
+@MetricsFactory
+public class CompoundPinotMetricsFactory implements PinotMetricsFactory {
+  public static final Logger LOGGER = 
LoggerFactory.getLogger(CompoundPinotMetricsFactory.class);
+  /**
+   * The suffix property used to define the algorithm used to look for other 
registries. It will be prefixed with the
+   * corresponding property prefix (like pinot.server.plugin.metrics, 
pinot.broker.plugin.metrics, etc).
+   *
+   * See {@link Algorithm}
+   */
+  public static final String ALGORITHM_KEY = "compound.algorithm";
+  /**
+   * The suffix property used to define a list of metric registries to ignore. 
It will be prefixed with the
+   * corresponding property prefix (like pinot.server.plugin.metrics, 
pinot.broker.plugin.metrics, etc).
+   *
+   * The list of metrics factory classes we want to ignore. They have to be 
actual names that can be converted into
+   * classes by using {@link Class#forName(String)}. Any {@link 
PinotMetricsRegistry} that is implements or extends any
+   * of the factories included here will be ignored by this metric registry.
+   */
+  public static final String IGNORED_METRICS = "compound.ignored";
+  /**
+   * The suffix property used to define a list of metric registries to include 
when using {@link Algorithm#LIST}.
+   * It will be prefixed with the corresponding property prefix (like 
pinot.server.plugin.metrics,
+   * pinot.broker.plugin.metrics, etc).
+   *
+   * Each value should be the name of a class that implements {@link 
PinotMetricsFactory} and can be instantiated with
+   * the {@link PluginManager}.
+   */
+  public static final String LIST_KEY = "compound.list";
+  private List<PinotMetricsFactory> _factories;
+  private CompoundPinotMetricRegistry _registry;
+
+  @Override
+  public void init(PinotConfiguration metricsConfiguration) {
+    String algorithmName = metricsConfiguration.getProperty(ALGORITHM_KEY, 
Algorithm.CLASSPATH.name());
+
+    Set<Class<?>> allIgnored = 
metricsConfiguration.getProperty(IGNORED_METRICS, 
Collections.emptyList()).stream()
+        .flatMap(ignoredClassName -> {
+          try {
+            return Stream.of(Class.forName(ignoredClassName));
+          } catch (ClassNotFoundException ex) {
+            LOGGER.warn("Ignored metric factory {} cannot be found", 
ignoredClassName);
+            return Stream.empty();
+          }
+        })
+        .collect(Collectors.toSet());
+
+    Algorithm algorithm = 
Algorithm.valueOf(algorithmName.toUpperCase(Locale.US));
+    _factories = algorithm.streamInstances(metricsConfiguration)
+        .filter(factory -> allIgnored.stream().noneMatch(ignored -> 
ignored.isAssignableFrom(factory.getClass())))
+        .filter(factory -> 
CompoundPinotMetricsFactory.class.isAssignableFrom(factory.getClass()))
+        .collect(Collectors.toList());
+
+    if (_factories.isEmpty()) {
+      throw new IllegalStateException("There is no metric factory to be used");
+    }
+    for (PinotMetricsFactory factory : _factories) {
+      factory.init(metricsConfiguration);
+    }
+  }
+
+  @Override
+  public PinotMetricsRegistry getPinotMetricsRegistry() {
+    if (_registry == null) {
+      List<PinotMetricsRegistry> allRegistries =
+          
_factories.stream().map(PinotMetricsFactory::getPinotMetricsRegistry).collect(Collectors.toList());
+      _registry = new CompoundPinotMetricRegistry(allRegistries);
+    }
+    return _registry;
+  }
+
+  @Override
+  public PinotMetricName makePinotMetricName(Class<?> klass, String name) {
+    List<PinotMetricName> names = _factories.stream()
+        .map(factory -> factory.makePinotMetricName(klass, name))
+        .collect(Collectors.toList());
+    return new CompoundPinotMetricName(name, names);
+  }
+
+  @Override
+  public <T> PinotGauge<T> makePinotGauge(Function<Void, T> condition) {
+    List<PinotGauge<T>> gauges = _factories.stream()
+        .map(factory -> factory.makePinotGauge(condition))
+        .collect(Collectors.toList());
+    return new CompoundPinotGauge<T>(gauges);
+  }
+
+  @Override
+  public PinotJmxReporter makePinotJmxReporter(PinotMetricsRegistry 
metricsRegistry) {
+    CompoundPinotMetricRegistry registry = (CompoundPinotMetricRegistry) 
metricsRegistry;
+    List<PinotMetricsRegistry> subRegistries = registry.getRegistries();
+    Preconditions.checkState(subRegistries.size() == _factories.size(),
+        "Number of registries ({}) should be the same than the number of 
factories ({})",
+        subRegistries.size(), _factories.size());
+
+    ArrayList<PinotJmxReporter> subJmx = new ArrayList<>(_factories.size());
+    for (int i = 0; i < _factories.size(); i++) {
+      PinotMetricsFactory subFactory = _factories.get(i);
+      PinotMetricsRegistry subRegistry = subRegistries.get(i);
+
+      subJmx.add(subFactory.makePinotJmxReporter(subRegistry));
+    }
+
+    return new CompoundPinotJmxReporter(subJmx);
+  }
+
+  @Override
+  public String getMetricsFactoryName() {
+    return "Compound";
+  }
+
+  /**
+   * How to look for other {@link PinotMetricsFactory}.
+   */
+  enum Algorithm {
+    /**
+     * An algorithm that returns all {@link PinotMetricsFactory} defined as 
{@link ServiceLoader}.
+     */
+    SERVICE_LOADER {
+      @Override
+      protected Stream<PinotMetricsFactory> streamInstances(PinotConfiguration 
metricsConfiguration) {
+        ArrayList<PinotMetricsFactory> result = new ArrayList<>();
+        for (PinotMetricsFactory factory : 
ServiceLoader.load(PinotMetricsFactory.class)) {
+          result.add(factory);
+        }
+        return result.stream();
+      }
+    },
+    /**
+     * An algorithm that returns all factories returned by {@link 
PinotMetricUtils#getPinotMetricsFactoryClasses()}.
+     */
+    CLASSPATH {
+      @Override
+      protected Stream<PinotMetricsFactory> streamInstances(PinotConfiguration 
metricsConfiguration) {
+        return PinotMetricUtils.getPinotMetricsFactoryClasses().stream()
+            .map(clazz -> {
+                  try {
+                    return (PinotMetricsFactory) 
clazz.getDeclaredConstructor().newInstance();
+                  } catch (Exception ex) {
+                    throw new IllegalArgumentException("Cannot instantiate 
class " + clazz, ex);
+                  }
+                }
+            );
+      }
+    },
+    /**
+     * An algorithm returns all the factories listed in the config under the 
{@link #LIST_KEY}.
+     */
+    LIST {
+      @Override
+      protected Stream<PinotMetricsFactory> streamInstances(PinotConfiguration 
metricsConfiguration) {
+        return metricsConfiguration.getProperty(LIST_KEY, 
Collections.emptyList()).stream()
+            .map(className -> {
+                  try {
+                    return PluginManager.get().createInstance(className);
+                  } catch (ClassNotFoundException ex) {
+                    throw new IllegalArgumentException("Cannot find metric 
factory named " + className, ex);
+                  } catch (Exception ex) {
+                    throw new IllegalArgumentException("Cannot instantiate 
class " + className, ex);
+                  }
+                }
+            );
+      }
+    };
+
+    abstract protected Stream<PinotMetricsFactory> 
streamInstances(PinotConfiguration metricsConfiguration);
+  }
+}
diff --git 
a/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotTimer.java
 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotTimer.java
new file mode 100644
index 0000000000..a91d22bef0
--- /dev/null
+++ 
b/pinot-plugins/pinot-metrics/pinot-compound-metrics/src/main/java/org/apache/pinot/plugin/metrics/compound/CompoundPinotTimer.java
@@ -0,0 +1,82 @@
+/**
+ * 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.plugin.metrics.compound;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import org.apache.pinot.spi.metrics.PinotTimer;
+
+
+public class CompoundPinotTimer extends 
AbstractCompoundPinotMetric<PinotTimer> implements PinotTimer {
+  public CompoundPinotTimer(List<PinotTimer> metrics) {
+    super(metrics);
+  }
+
+  @Override
+  public Object getMetered() {
+    return getMetric();
+  }
+
+  @Override
+  public TimeUnit rateUnit() {
+    return getSomeMeter().rateUnit();
+  }
+
+  @Override
+  public String eventType() {
+    return getSomeMeter().eventType();
+  }
+
+  @Override
+  public long count() {
+    return getSomeMeter().count();
+  }
+
+  @Override
+  public double fifteenMinuteRate() {
+    return getSomeMeter().fifteenMinuteRate();
+  }
+
+  @Override
+  public double fiveMinuteRate() {
+    return getSomeMeter().fiveMinuteRate();
+  }
+
+  @Override
+  public double meanRate() {
+    return getSomeMeter().meanRate();
+  }
+
+  @Override
+  public double oneMinuteRate() {
+    return getSomeMeter().oneMinuteRate();
+  }
+
+  @Override
+  public void update(long duration, TimeUnit unit) {
+    for (PinotTimer timer : _metrics) {
+      timer.update(duration, unit);
+    }
+  }
+
+  @Override
+  public Object getTimer() {
+    return getMetric();
+  }
+}
diff --git a/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml 
b/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml
index 1f6b389aa1..d865e13979 100644
--- a/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml
+++ b/pinot-plugins/pinot-metrics/pinot-dropwizard/pom.xml
@@ -53,6 +53,10 @@
       <groupId>io.dropwizard.metrics</groupId>
       <artifactId>metrics-jmx</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service-annotations</artifactId>
+    </dependency>
   </dependencies>
 
   <profiles>
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
 
b/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
index 40114dc5f4..70c1a2b773 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardJmxReporter.java
@@ -27,8 +27,10 @@ import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
 public class DropwizardJmxReporter implements PinotJmxReporter {
   private final JmxReporter _jmxReporter;
 
-  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry) {
-    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry()).build();
+  public DropwizardJmxReporter(PinotMetricsRegistry metricsRegistry, String 
domainName) {
+    _jmxReporter = JmxReporter.forRegistry((MetricRegistry) 
metricsRegistry.getMetricsRegistry())
+        .inDomain(domainName)
+        .build();
   }
 
   @Override
diff --git 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardMetricsFactory.java
 
b/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardMetricsFactory.java
index be218d01a1..0f80b9aa02 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardMetricsFactory.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-dropwizard/src/main/java/org/apache/pinot/plugin/metrics/dropwizard/DropwizardMetricsFactory.java
@@ -18,6 +18,7 @@
  */
 package org.apache.pinot.plugin.metrics.dropwizard;
 
+import com.google.auto.service.AutoService;
 import java.util.function.Function;
 import org.apache.pinot.spi.annotations.metrics.MetricsFactory;
 import org.apache.pinot.spi.annotations.metrics.PinotMetricsFactory;
@@ -28,12 +29,18 @@ import org.apache.pinot.spi.metrics.PinotMetricName;
 import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
 
 
+@AutoService(PinotMetricsFactory.class)
 @MetricsFactory
 public class DropwizardMetricsFactory implements PinotMetricsFactory {
+  public static final String DOMAIN_PROP = "pinot.metrics.dropwizard.domain";
+  // this is the default in Dropwizard, which was used in Pinot before 2023
+  public static final String DEFAULT_DOMAIN_VALUE = 
"org.apache.pinot.common.metrics";
   private PinotMetricsRegistry _pinotMetricsRegistry = null;
+  private String _domainName;
 
   @Override
   public void init(PinotConfiguration metricsConfiguration) {
+    _domainName = metricsConfiguration.getProperty(DOMAIN_PROP, 
DEFAULT_DOMAIN_VALUE);
   }
 
   @Override
@@ -56,7 +63,7 @@ public class DropwizardMetricsFactory implements 
PinotMetricsFactory {
 
   @Override
   public PinotJmxReporter makePinotJmxReporter(PinotMetricsRegistry 
metricsRegistry) {
-    return new DropwizardJmxReporter(metricsRegistry);
+    return new DropwizardJmxReporter(metricsRegistry, _domainName);
   }
 
   @Override
diff --git a/pinot-plugins/pinot-metrics/pinot-yammer/pom.xml 
b/pinot-plugins/pinot-metrics/pinot-yammer/pom.xml
index d783f46ab4..d3e278b95f 100644
--- a/pinot-plugins/pinot-metrics/pinot-yammer/pom.xml
+++ b/pinot-plugins/pinot-metrics/pinot-yammer/pom.xml
@@ -40,6 +40,10 @@
       <groupId>com.yammer.metrics</groupId>
       <artifactId>metrics-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service-annotations</artifactId>
+    </dependency>
   </dependencies>
 
   <profiles>
diff --git 
a/pinot-plugins/pinot-metrics/pinot-yammer/src/main/java/org/apache/pinot/plugin/metrics/yammer/YammerMetricsFactory.java
 
b/pinot-plugins/pinot-metrics/pinot-yammer/src/main/java/org/apache/pinot/plugin/metrics/yammer/YammerMetricsFactory.java
index 933b7962e3..f2f0e0788f 100644
--- 
a/pinot-plugins/pinot-metrics/pinot-yammer/src/main/java/org/apache/pinot/plugin/metrics/yammer/YammerMetricsFactory.java
+++ 
b/pinot-plugins/pinot-metrics/pinot-yammer/src/main/java/org/apache/pinot/plugin/metrics/yammer/YammerMetricsFactory.java
@@ -18,6 +18,7 @@
  */
 package org.apache.pinot.plugin.metrics.yammer;
 
+import com.google.auto.service.AutoService;
 import java.util.function.Function;
 import org.apache.pinot.spi.annotations.metrics.MetricsFactory;
 import org.apache.pinot.spi.annotations.metrics.PinotMetricsFactory;
@@ -28,6 +29,7 @@ import org.apache.pinot.spi.metrics.PinotMetricName;
 import org.apache.pinot.spi.metrics.PinotMetricsRegistry;
 
 
+@AutoService(PinotMetricsFactory.class)
 @MetricsFactory
 public class YammerMetricsFactory implements PinotMetricsFactory {
   private PinotMetricsRegistry _pinotMetricsRegistry = null;
diff --git a/pinot-plugins/pinot-metrics/pom.xml 
b/pinot-plugins/pinot-metrics/pom.xml
index 2d8b25ea8c..353ca2baf2 100644
--- a/pinot-plugins/pinot-metrics/pom.xml
+++ b/pinot-plugins/pinot-metrics/pom.xml
@@ -37,6 +37,7 @@
   <modules>
     <module>pinot-dropwizard</module>
     <module>pinot-yammer</module>
+    <module>pinot-compound-metrics</module>
   </modules>
 
   <dependencies>
diff --git 
a/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricUtils.java 
b/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricUtils.java
index 93ac36e07c..90fd53527e 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricUtils.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/metrics/PinotMetricUtils.java
@@ -104,7 +104,7 @@ public class PinotMetricUtils {
             + " the classpath.");
   }
 
-  private static Set<Class<?>> getPinotMetricsFactoryClasses() {
+  public static Set<Class<?>> getPinotMetricsFactoryClasses() {
     return 
PinotReflectionUtils.getClassesThroughReflection(METRICS_PACKAGE_REGEX_PATTERN, 
MetricsFactory.class);
   }
 
diff --git 
a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java 
b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
index e889b5e0f7..a89db355b5 100644
--- a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
+++ b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java
@@ -48,7 +48,9 @@ public class CommonConstants {
   public static final String CONFIG_OF_BROKER_EVENT_LISTENER_CLASS_NAME = 
"factory.className";
   public static final String CONFIG_OF_REQUEST_CONTEXT_TRACKED_HEADER_KEYS = 
"request.context.tracked.header.keys";
   public static final String DEFAULT_METRICS_FACTORY_CLASS_NAME =
+      //"org.apache.pinot.plugin.metrics.compound.CompoundPinotMetricsFactory";
       "org.apache.pinot.plugin.metrics.yammer.YammerMetricsFactory";
+      //"org.apache.pinot.plugin.metrics.dropwizard.DropwizardMetricsFactory";
   public static final String DEFAULT_BROKER_EVENT_LISTENER_CLASS_NAME =
       "org.apache.pinot.spi.eventlistener.query.NoOpBrokerQueryEventListener";
 
diff --git a/pinot-tools/pom.xml b/pinot-tools/pom.xml
index 64ef2d150c..72785168ab 100644
--- a/pinot-tools/pom.xml
+++ b/pinot-tools/pom.xml
@@ -122,7 +122,15 @@
     <dependency>
       <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-yammer</artifactId>
-      <scope>runtime</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.pinot</groupId>
+      <artifactId>pinot-dropwizard</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.pinot</groupId>
+      <artifactId>pinot-compound-metrics</artifactId>
     </dependency>
 
     <dependency>
diff --git a/pom.xml b/pom.xml
index ddfbd394f9..6ae7141070 100644
--- a/pom.xml
+++ b/pom.xml
@@ -648,6 +648,11 @@
         <artifactId>pinot-dropwizard</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.pinot</groupId>
+        <artifactId>pinot-compound-metrics</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <!-- Minion Tasks -->
       <dependency>
         <groupId>org.apache.pinot</groupId>


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

Reply via email to