diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a7a1d1b66d..87308f9289 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -905,6 +905,8 @@ Release 2.8.0 - UNRELEASED
HADOOP-9692. Improving log message when SequenceFile reader throws
EOFException on zero-length file. (Zhe Zhang and Chu Tong via ozawa)
+ HADOOP-7266. Deprecate metrics v1. (Akira AJISAKA via ozawa)
+
OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
index 6fd34d566a..d59320554e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
@@ -541,7 +541,9 @@ private void setContextAttributes(Context context, Configuration conf) {
/**
* Add default servlets.
+ * Note: /metrics servlet will be removed in 3.X release.
*/
+ @SuppressWarnings("deprecation")
protected void addDefaultServlets() {
// set up default servlets
addServlet("stacks", "/stacks", StackServlet.class);
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ContextFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ContextFactory.java
index 034ea3589a..15ecd61b0e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ContextFactory.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ContextFactory.java
@@ -36,7 +36,10 @@
/**
* Factory class for creating MetricsContext objects. To obtain an instance
* of this class, use the static getFactory()
method.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public class ContextFactory {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsContext.java
index e297e3738b..aa08641336 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsContext.java
@@ -30,7 +30,10 @@
/**
* The main interface to the metrics package.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface MetricsContext {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsException.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsException.java
index de7139549f..5fcf7513f3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsException.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsException.java
@@ -25,7 +25,9 @@
/**
* General-purpose, unchecked metrics exception.
+ * @deprecated Use {@link org.apache.hadoop.metrics2.MetricsException} instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public class MetricsException extends RuntimeException {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsRecord.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsRecord.java
index 45701c570f..d252a1719b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsRecord.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsRecord.java
@@ -67,7 +67,10 @@
* it is OK for different threads to call update()
on MetricsRecord instances
* with the same set of tag names and tag values. Different threads should
* not use the same MetricsRecord instance at the same time.
+ *
+ * @deprecated Use {@link org.apache.hadoop.metrics2.MetricsRecord} instead.
*/
+@Deprecated
@InterfaceAudience.Private
@InterfaceStability.Evolving
public interface MetricsRecord {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java
index 7eb2c55aec..8e592ad4a8 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsServlet.java
@@ -43,7 +43,10 @@
* A servlet to print out metrics data. By default, the servlet returns a
* textual representation (no promises are made for parseability), and
* users can use "?format=json" for parseable output.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class MetricsServlet extends HttpServlet {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java
index 5117d1b294..403fdf39f1 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/MetricsUtil.java
@@ -32,7 +32,9 @@
* @see org.apache.hadoop.metrics.MetricsRecord
* @see org.apache.hadoop.metrics.MetricsContext
* @see org.apache.hadoop.metrics.ContextFactory
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public class MetricsUtil {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/Updater.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/Updater.java
index 9c602dd198..c1a80171ef 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/Updater.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/Updater.java
@@ -25,7 +25,10 @@
/**
* Call-back interface. See MetricsContext.registerUpdater()
.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
@InterfaceStability.Evolving
public interface Updater {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
index 5ed2652b11..7e75d2de1f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
@@ -39,8 +39,11 @@
/**
* Context for sending metrics to Ganglia.
- *
+ *
+ * @deprecated Use {@link org.apache.hadoop.metrics2.sink.ganglia.GangliaSink30}
+ * instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class GangliaContext extends AbstractMetricsContext {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java
index 9ad2d39ea9..5a53d1b3a3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/ganglia/GangliaContext31.java
@@ -35,7 +35,11 @@
* Context for sending metrics to Ganglia version 3.1.x.
*
* 3.1.1 has a slightly different wire portal compared to 3.0.x.
+ *
+ * @deprecated Use {@link org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31}
+ * instead.
*/
+@Deprecated
public class GangliaContext31 extends GangliaContext {
String hostName = "UNKNOWN.example.com";
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/EventCounter.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/EventCounter.java
index 599cb82c60..c6d5ca7d0e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/EventCounter.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/EventCounter.java
@@ -20,7 +20,10 @@
/**
* A log4J Appender that simply counts logging events in three levels:
* fatal, error and warn.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
public class EventCounter extends org.apache.hadoop.log.metrics.EventCounter {
static {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java
index ec8a9c2a63..f9ab94a421 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java
@@ -40,7 +40,10 @@
* Singleton class which reports Java Virtual Machine metrics to the metrics API.
* Any application can create an instance of this class in order to emit
* Java VM metrics.
+ *
+ * @deprecated Use {@link org.apache.hadoop.metrics2.source.JvmMetrics} instead.
*/
+@Deprecated
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class JvmMetrics implements Updater {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
index 067dc358d6..dccfbe9fd8 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
@@ -51,7 +51,10 @@
* on which data is to be sent to the metrics system. Subclasses must
* override the abstract emitRecord
method in order to transmit
* the data.
update
* and remove()
.
+ *
+ * @deprecated Use {@link org.apache.hadoop.metrics2.impl.MetricsRecordImpl}
+ * instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class MetricsRecordImpl implements MetricsRecord {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java
index 7d992ab314..f3ca882ac3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java
@@ -28,7 +28,10 @@
*
* This is useful if you want to support {@link MetricsServlet}, but
* not emit metrics in any other way.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class NoEmitMetricsContext extends AbstractMetricsContext {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java
index 39b58cf49f..38c0cd2ada 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContext.java
@@ -27,7 +27,9 @@
* default context, so that no performance data is emitted if no configuration
* data is found.
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class NullContext extends AbstractMetricsContext {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
index ff2a49c69a..518a8861ec 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
@@ -33,7 +33,9 @@
* The default impl of start and stop monitoring:
* is the AbstractMetricsContext is good enough.
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class NullContextWithUpdateThread extends AbstractMetricsContext {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/OutputRecord.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/OutputRecord.java
index d94c8ab46e..4f0865e136 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/OutputRecord.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/OutputRecord.java
@@ -29,7 +29,10 @@
/**
* Represents a record of metric data to be sent to a metrics system.
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class OutputRecord {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/Util.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/Util.java
index 32aa431991..6fb7c9ee56 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/Util.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/Util.java
@@ -31,7 +31,10 @@
/**
* Static utility methods
+ *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class Util {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MBeanUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MBeanUtil.java
index 2032d8f5e3..7746b4fdf6 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MBeanUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MBeanUtil.java
@@ -33,7 +33,9 @@
* our standard naming convention as described in the doc
* for {link {@link #registerMBean(String, String, Object)}
*
+ * @deprecated Use {@link org.apache.hadoop.metrics2.util.MBeans} instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public class MBeanUtil {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsBase.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsBase.java
index 93e8494858..96d7b6147c 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsBase.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsBase.java
@@ -24,7 +24,9 @@
*
* This is base class for all metrics
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.Private
public abstract class MetricsBase {
public static final String NO_DESCRIPTION = "NoDescription";
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java
index 9c9164eaf4..24932d6727 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java
@@ -51,8 +51,9 @@
* ObjectName mbeanName = MBeanUtil.registerMBean("ServiceFoo",
* "TestStatistics", theMBean);
*
- *
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public abstract class MetricsDynamicMBeanBase implements DynamicMBean {
private final static String AVG_TIME = "AvgTime";
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java
index f7a173a2fb..d0a258bcd3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsIntValue.java
@@ -28,7 +28,9 @@
* Each time its value is set, it is published only *once* at the next update
* call.
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public class MetricsIntValue extends MetricsBase {
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java
index c122636575..b00a739ef0 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsLongValue.java
@@ -27,7 +27,9 @@
* Each time its value is set, it is published only *once* at the next update
* call.
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public class MetricsLongValue extends MetricsBase{
private long value;
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsRegistry.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsRegistry.java
index 58f1929d6e..2baa3d32fd 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsRegistry.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsRegistry.java
@@ -28,7 +28,9 @@
* Related set of metrics should be declared in a holding class and registered
* in a registry for those metrics which is also stored in the the holding class.
*
+ * @deprecated Use org.apache.hadoop.metrics2 package instead.
*/
+@Deprecated
@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
public class MetricsRegistry {
private ConcurrentHashMap