Browse Source

commit e1330796ccbde951002856d167e39ccec6df23fb
Author: Luke Lu <llu@yahoo-inc.com>
Date: Fri Oct 29 15:49:46 2010 -0700

HADOOP:6728 Metrics 2.0: deprecate old metrics code

See for patches/reviews.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/yahoo-merge@1079144 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 năm trước cách đây
mục cha
commit
1525be2b13
30 tập tin đã thay đổi với 68 bổ sung10 xóa
  1. 2 0
      src/java/org/apache/hadoop/metrics/ContextFactory.java
  2. 2 0
      src/java/org/apache/hadoop/metrics/MetricsContext.java
  3. 2 0
      src/java/org/apache/hadoop/metrics/MetricsException.java
  4. 2 0
      src/java/org/apache/hadoop/metrics/MetricsRecord.java
  5. 2 0
      src/java/org/apache/hadoop/metrics/MetricsServlet.java
  6. 2 0
      src/java/org/apache/hadoop/metrics/MetricsUtil.java
  7. 2 0
      src/java/org/apache/hadoop/metrics/Updater.java
  8. 2 0
      src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
  9. 2 0
      src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java
  10. 5 4
      src/java/org/apache/hadoop/metrics/package.html
  11. 2 0
      src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
  12. 4 0
      src/java/org/apache/hadoop/metrics/spi/CompositeContext.java
  13. 2 0
      src/java/org/apache/hadoop/metrics/spi/MetricValue.java
  14. 2 0
      src/java/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java
  15. 2 0
      src/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java
  16. 2 0
      src/java/org/apache/hadoop/metrics/spi/NullContext.java
  17. 2 0
      src/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java
  18. 2 0
      src/java/org/apache/hadoop/metrics/spi/OutputRecord.java
  19. 6 4
      src/java/org/apache/hadoop/metrics/spi/package.html
  20. 3 1
      src/java/org/apache/hadoop/metrics/util/MBeanUtil.java
  21. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsBase.java
  22. 2 1
      src/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java
  23. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsIntValue.java
  24. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsLongValue.java
  25. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsRegistry.java
  26. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingInt.java
  27. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingLong.java
  28. 2 0
      src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingRate.java
  29. 1 0
      src/test/core/org/apache/hadoop/metrics/TestMetricsServlet.java
  30. 1 0
      src/test/core/org/apache/hadoop/metrics/spi/TestOutputRecord.java

+ 2 - 0
src/java/org/apache/hadoop/metrics/ContextFactory.java

@@ -36,7 +36,9 @@ import org.apache.hadoop.metrics.spi.NullContext;
 /**
  * Factory class for creating MetricsContext objects.  To obtain an instance
  * of this class, use the static <code>getFactory()</code> method.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 @InterfaceStability.Evolving
 public class ContextFactory {

+ 2 - 0
src/java/org/apache/hadoop/metrics/MetricsContext.java

@@ -30,7 +30,9 @@ import org.apache.hadoop.metrics.spi.OutputRecord;
 
 /**
  * The main interface to the metrics package. 
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Private
 @InterfaceStability.Evolving
 public interface MetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/MetricsException.java

@@ -25,7 +25,9 @@ import org.apache.hadoop.classification.InterfaceStability;
 
 /**
  * General-purpose, unchecked metrics exception.
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.MetricsException}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 @InterfaceStability.Evolving
 public class MetricsException extends RuntimeException {

+ 2 - 0
src/java/org/apache/hadoop/metrics/MetricsRecord.java

@@ -67,7 +67,9 @@ import org.apache.hadoop.classification.InterfaceStability;
  * it is OK for different threads to call <code>update()</code> on MetricsRecord instances 
  * with the same set of tag names and tag values.  Different threads should 
  * <b>not</b> use the same MetricsRecord instance at the same time.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Private
 @InterfaceStability.Evolving
 public interface MetricsRecord {

+ 2 - 0
src/java/org/apache/hadoop/metrics/MetricsServlet.java

@@ -43,7 +43,9 @@ import org.mortbay.util.ajax.JSON.Output;
  * 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 in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Private
 @InterfaceStability.Evolving
 public class MetricsServlet extends HttpServlet {

+ 2 - 0
src/java/org/apache/hadoop/metrics/MetricsUtil.java

@@ -32,7 +32,9 @@ import org.apache.hadoop.classification.InterfaceStability;
  * @see org.apache.hadoop.metrics.MetricsRecord
  * @see org.apache.hadoop.metrics.MetricsContext
  * @see org.apache.hadoop.metrics.ContextFactory
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 @InterfaceStability.Evolving
 public class MetricsUtil {

+ 2 - 0
src/java/org/apache/hadoop/metrics/Updater.java

@@ -25,7 +25,9 @@ import org.apache.hadoop.classification.InterfaceStability;
 
 /**
  * Call-back interface.  See <code>MetricsContext.registerUpdater()</code>.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 @InterfaceStability.Evolving
 public interface Updater {

+ 2 - 0
src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java

@@ -43,7 +43,9 @@ import org.apache.hadoop.metrics.spi.Util;
 /**
  * Context for sending metrics to Ganglia.
  * 
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class GangliaContext extends AbstractMetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java

@@ -40,7 +40,9 @@ import org.apache.commons.logging.LogFactory;
  * 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 in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Private
 @InterfaceStability.Evolving
 public class JvmMetrics implements Updater {

+ 5 - 4
src/java/org/apache/hadoop/metrics/package.html

@@ -21,13 +21,14 @@
     <title>org.apache.hadoop.metrics</title>
   </head>
 <body>
-This package defines an API for reporting performance metric information.
-<p/>
-The API is abstract so that it can be implemented on top of
+  <p><em>Note, this package is deprecated in favor of
+    <code>org.apache.hadoop.metrics2</code> usage.</em></p>
+  <p>This package defines an API for reporting performance metric information.</p>
+  <p>The API is abstract so that it can be implemented on top of
 a variety of metrics client libraries.  The choice of 
 client library is a configuration option, and different 
 modules within the same application can use
-different metrics implementation libraries.
+different metrics implementation libraries.</p>
 <p/>
 Sub-packages:
 <dl>

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java

@@ -51,7 +51,9 @@ import org.apache.hadoop.metrics.Updater;
  * on which data is to be sent to the metrics system.  Subclasses must
  * override the abstract <code>emitRecord</code> method in order to transmit
  * the data. <p/>
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public abstract class AbstractMetricsContext implements MetricsContext {

+ 4 - 0
src/java/org/apache/hadoop/metrics/spi/CompositeContext.java

@@ -35,6 +35,10 @@ import org.apache.hadoop.metrics.MetricsRecord;
 import org.apache.hadoop.metrics.MetricsUtil;
 import org.apache.hadoop.metrics.Updater;
 
+/**
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
+ */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class CompositeContext extends AbstractMetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/MetricValue.java

@@ -25,7 +25,9 @@ import org.apache.hadoop.classification.InterfaceStability;
 
 /**
  * A Number that is either an absolute or an incremental amount.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class MetricValue {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java

@@ -33,7 +33,9 @@ import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap;
  * An implementation of MetricsRecord.  Keeps a back-pointer to the context
  * from which it was created, and delegates back to it on <code>update</code>
  * and <code>remove()</code>.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class MetricsRecordImpl implements MetricsRecord {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/NoEmitMetricsContext.java

@@ -28,7 +28,9 @@ import org.apache.hadoop.metrics.MetricsServlet;
  * 
  * This is useful if you want to support {@link MetricsServlet}, but
  * not emit metrics in any other way.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class NoEmitMetricsContext extends AbstractMetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/NullContext.java

@@ -27,7 +27,9 @@ import org.apache.hadoop.classification.InterfaceStability;
  * default context, so that no performance data is emitted if no configuration
  * data is found.
  * 
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class NullContext extends AbstractMetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/NullContextWithUpdateThread.java

@@ -34,7 +34,9 @@ import org.apache.hadoop.metrics.MetricsException;
  * The default impl of start and stop monitoring:
  *  is the AbstractMetricsContext is good enough.
  * 
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class NullContextWithUpdateThread extends AbstractMetricsContext {

+ 2 - 0
src/java/org/apache/hadoop/metrics/spi/OutputRecord.java

@@ -33,7 +33,9 @@ import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap;
 
 /**
  * Represents a record of metric data to be sent to a metrics system.
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public class OutputRecord {

+ 6 - 4
src/java/org/apache/hadoop/metrics/spi/package.html

@@ -22,15 +22,17 @@
     <title>org.apache.hadoop.metrics.spi</title>
   </head>
   <body>
-The Service Provider Interface for the Metrics API.  This package provides
+    <p><em>Note, this package is deprecated in favor of
+      <code>org.apache.hadoop.metrics2</code> usage.</em></p>
+      <p>The Service Provider Interface for the Metrics API.  This package provides
 an interface allowing a variety of metrics reporting implementations to be
 plugged in to the Metrics API.  Examples of such implementations can be found 
 in the packages <code>org.apache.hadoop.metrics.file</code> and
-<code>org.apache.hadoop.metrics.ganglia</code>.<p/>
+<code>org.apache.hadoop.metrics.ganglia</code>.</p>
 
-Plugging in an implementation involves writing a concrete subclass of 
+      <p>Plugging in an implementation involves writing a concrete subclass of
 <code>AbstractMetricsContext</code>.  The subclass should get its
  configuration information using the <code>getAttribute(<i>attributeName</i>)</code>
- method.
+ method.</p>
   </body>
 </html>

+ 3 - 1
src/java/org/apache/hadoop/metrics/util/MBeanUtil.java

@@ -31,9 +31,11 @@ import org.apache.hadoop.classification.InterfaceAudience;
 /**
  * This util class provides a method to register an MBean using
  * our standard naming convention as described in the doc
- *  for {link {@link #registerMBean(String, String, Object)}
+ *  for {@link #registerMBean(String, String, Object)}
  *
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.util.MBeans}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MBeanUtil {
 	

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsBase.java

@@ -24,7 +24,9 @@ import org.apache.hadoop.metrics.MetricsRecord;
  * 
  * This is base class for all metrics
  *
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.Private
 public abstract class MetricsBase {
   public static final String NO_DESCRIPTION = "NoDescription";

+ 2 - 1
src/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java

@@ -51,8 +51,9 @@ import org.apache.hadoop.metrics.MetricsUtil;
  *  ObjectName mbeanName = MBeanUtil.registerMBean("ServiceFoo",
  *                "TestStatistics", theMBean);
  * 
- *
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public abstract class MetricsDynamicMBeanBase implements DynamicMBean {
   private final static String AVG_TIME = "AvgTime";

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsIntValue.java

@@ -30,7 +30,9 @@ import org.apache.commons.logging.LogFactory;
  * Each time its value is set, it is published only *once* at the next update
  * call.
  *
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.lib.MutableGaugeInt}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsIntValue extends MetricsBase {  
 

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsLongValue.java

@@ -27,7 +27,9 @@ import org.apache.hadoop.metrics.MetricsRecord;
  * Each time its value is set, it is published only *once* at the next update
  * call.
  *
+ * @deprecated in favor of <code>org.apache.hadoop.metrics2</code> usage.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsLongValue extends MetricsBase{  
   private long value;

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsRegistry.java

@@ -29,7 +29,9 @@ import org.apache.hadoop.classification.InterfaceAudience;
  * 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 in favor of {@link org.apache.hadoop.metrics2.lib.MetricsRegistry}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsRegistry {
   private Map<String, MetricsBase> metricsList = new HashMap<String, MetricsBase>();

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingInt.java

@@ -34,7 +34,9 @@ import org.apache.commons.logging.LogFactory;
  * Note if one wants a time associated with the metric then use
  * @see org.apache.hadoop.metrics.util.MetricsTimeVaryingRate
  *
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.lib.MutableCounterInt}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsTimeVaryingInt extends MetricsBase {
 

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingLong.java

@@ -35,7 +35,9 @@ import org.apache.commons.logging.LogFactory;
  * Note if one wants a time associated with the metric then use
  * @see org.apache.hadoop.metrics.util.MetricsTimeVaryingRate
  *
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.lib.MutableCounterLong}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsTimeVaryingLong extends MetricsBase{
 

+ 2 - 0
src/java/org/apache/hadoop/metrics/util/MetricsTimeVaryingRate.java

@@ -32,7 +32,9 @@ import org.apache.commons.logging.LogFactory;
  * This class also keeps track of the min and max rates along with 
  * a method to reset the min-max.
  *
+ * @deprecated in favor of {@link org.apache.hadoop.metrics2.lib.MutableRate}.
  */
+@Deprecated
 @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"})
 public class MetricsTimeVaryingRate extends MetricsBase {
 

+ 1 - 0
src/test/core/org/apache/hadoop/metrics/TestMetricsServlet.java

@@ -32,6 +32,7 @@ import org.apache.hadoop.metrics.spi.NoEmitMetricsContext;
 import org.apache.hadoop.metrics.spi.OutputRecord;
 import org.mortbay.util.ajax.JSON;
 
+@Deprecated
 public class TestMetricsServlet extends TestCase {
   MetricsContext nc1;
   MetricsContext nc2;

+ 1 - 0
src/test/core/org/apache/hadoop/metrics/spi/TestOutputRecord.java

@@ -22,6 +22,7 @@ import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap;
 
 import junit.framework.TestCase;
 
+@Deprecated
 public class TestOutputRecord extends TestCase {
   public void testCopy() {
     TagMap tags = new TagMap();