incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbeerbo...@apache.org
Subject svn commit: r1440365 - in /incubator/ambari/trunk: ./ ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/ ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/ ambari-server/src/test/resources/
Date Wed, 30 Jan 2013 12:07:45 GMT
Author: tbeerbower
Date: Wed Jan 30 12:07:45 2013
New Revision: 1440365

URL: http://svn.apache.org/viewvc?rev=1440365&view=rev
Log:
AMBARI-1285 - Some host Ganglia metrics may be missing in some cases.

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaComponentPropertyProvider.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostComponentPropertyProvider.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostPropertyProvider.java
    incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
    incubator/ambari/trunk/ambari-server/src/test/resources/temporal_ganglia_data.txt

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed Jan 30 12:07:45 2013
@@ -302,6 +302,8 @@ Trunk (unreleased changes):
  AMBARI-1301. Live status checks dont get triggered on server restart.
  (mahadev)
 
+ AMBARI-1285. Some host Ganglia metrics may be missing in some cases. (tbeerbower)
+
 AMBARI-1.2.0 branch:
 
  INCOMPATIBLE CHANGES

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaComponentPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaComponentPropertyProvider.java?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaComponentPropertyProvider.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaComponentPropertyProvider.java
Wed Jan 30 12:07:45 2013
@@ -22,7 +22,9 @@ import org.apache.ambari.server.controll
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
 
+import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Ganglia property provider implementation for component resources.
@@ -56,7 +58,7 @@ public class GangliaComponentPropertyPro
   }
 
   @Override
-  protected String getGangliaClusterName(Resource resource, String clusterName) {
-    return GANGLIA_CLUSTER_NAMES.get(getComponentName(resource));
+  protected Set<String> getGangliaClusterNames(Resource resource, String clusterName)
{
+    return Collections.singleton(GANGLIA_CLUSTER_NAME_MAP.get(getComponentName(resource)));
   }
 }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostComponentPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostComponentPropertyProvider.java?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostComponentPropertyProvider.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostComponentPropertyProvider.java
Wed Jan 30 12:07:45 2013
@@ -22,7 +22,9 @@ import org.apache.ambari.server.controll
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
 
+import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Ganglia property provider implementation for host component resources.
@@ -57,7 +59,7 @@ public class GangliaHostComponentPropert
   }
 
   @Override
-  protected String getGangliaClusterName(Resource resource, String clusterName) {
-    return GANGLIA_CLUSTER_NAMES.get(getComponentName(resource));
+  protected Set<String> getGangliaClusterNames(Resource resource, String clusterName)
{
+    return Collections.singleton(GANGLIA_CLUSTER_NAME_MAP.get(getComponentName(resource)));
   }
 }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostPropertyProvider.java?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostPropertyProvider.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaHostPropertyProvider.java
Wed Jan 30 12:07:45 2013
@@ -22,13 +22,27 @@ import org.apache.ambari.server.controll
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.utilities.StreamProvider;
 
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * Ganglia property provider implementation for host resources.
  */
 public class GangliaHostPropertyProvider extends GangliaPropertyProvider{
 
+  /**
+   * Set of Ganglia cluster names.
+   */
+  private static final Set<String> GANGLIA_CLUSTER_NAMES = new HashSet<String>();
+
+  static {
+    GANGLIA_CLUSTER_NAMES.add("HDPNameNode");
+    GANGLIA_CLUSTER_NAMES.add("HDPSlaves");
+    GANGLIA_CLUSTER_NAMES.add("HDPJobTracker");
+    GANGLIA_CLUSTER_NAMES.add("HDPHBaseMaster");
+  }
 
   // ----- Constructors ------------------------------------------------------
 
@@ -56,7 +70,7 @@ public class GangliaHostPropertyProvider
   }
 
   @Override
-  protected String getGangliaClusterName(Resource resource, String clusterName) {
-    return "HDPSlaves";
+  protected Set<String> getGangliaClusterNames(Resource resource, String clusterName)
{
+    return GANGLIA_CLUSTER_NAMES;
   }
 }

Modified: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
Wed Jan 30 12:07:45 2013
@@ -48,16 +48,16 @@ public abstract class GangliaPropertyPro
   /**
    * Map of Ganglia cluster names keyed by component type.
    */
-  public static final Map<String, String> GANGLIA_CLUSTER_NAMES = new HashMap<String,
String>();
+  public static final Map<String, String> GANGLIA_CLUSTER_NAME_MAP = new HashMap<String,
String>();
 
   static {
-    GANGLIA_CLUSTER_NAMES.put("NAMENODE",           "HDPNameNode");
-    GANGLIA_CLUSTER_NAMES.put("DATANODE",           "HDPSlaves");
-    GANGLIA_CLUSTER_NAMES.put("JOBTRACKER",         "HDPJobTracker");
-    GANGLIA_CLUSTER_NAMES.put("TASKTRACKER",        "HDPSlaves");
-    GANGLIA_CLUSTER_NAMES.put("HBASE_MASTER",       "HDPHBaseMaster");
-    GANGLIA_CLUSTER_NAMES.put("HBASE_CLIENT",       "HDPSlaves");
-    GANGLIA_CLUSTER_NAMES.put("HBASE_REGIONSERVER", "HDPSlaves");
+    GANGLIA_CLUSTER_NAME_MAP.put("NAMENODE", "HDPNameNode");
+    GANGLIA_CLUSTER_NAME_MAP.put("DATANODE", "HDPSlaves");
+    GANGLIA_CLUSTER_NAME_MAP.put("JOBTRACKER", "HDPJobTracker");
+    GANGLIA_CLUSTER_NAME_MAP.put("TASKTRACKER", "HDPSlaves");
+    GANGLIA_CLUSTER_NAME_MAP.put("HBASE_MASTER", "HDPHBaseMaster");
+    GANGLIA_CLUSTER_NAME_MAP.put("HBASE_CLIENT", "HDPSlaves");
+    GANGLIA_CLUSTER_NAME_MAP.put("HBASE_REGIONSERVER", "HDPSlaves");
   }
 
   protected final static Logger LOG =
@@ -137,7 +137,7 @@ public abstract class GangliaPropertyPro
    *
    * @return the ganglia cluster name
    */
-  protected abstract String getGangliaClusterName(Resource resource, String clusterName);
+  protected abstract Set<String> getGangliaClusterNames(Resource resource, String clusterName);
 
 
   /**
@@ -197,26 +197,30 @@ public abstract class GangliaPropertyPro
         requestMap.put(clusterName, requests);
       }
 
-      ResourceKey key =
-          new ResourceKey(getHostName(resource), getGangliaClusterName(resource, clusterName));
+      Set<String> gangliaClusterNames = getGangliaClusterNames(resource, clusterName);
 
-      for (String id : ids) {
-        Map<String, PropertyInfo> propertyInfoMap = getPropertyInfoMap(getComponentName(resource),
id);
-
-        for (Map.Entry<String, PropertyInfo> entry : propertyInfoMap.entrySet()) {
-          String propertyId = entry.getKey();
-          PropertyInfo propertyInfo = entry.getValue();
-
-          TemporalInfo temporalInfo = request.getTemporalInfo(id);
-
-          if ((temporalInfo == null && propertyInfo.isPointInTime()) || (temporalInfo
!= null && propertyInfo.isTemporal())) {
-            RRDRequest rrdRequest = requests.get(temporalInfo);
-            if (rrdRequest == null) {
-              rrdRequest = new RRDRequest(clusterName, temporalInfo);
-              requests.put(temporalInfo, rrdRequest);
+      for (String gangliaClusterName : gangliaClusterNames) {
+        ResourceKey key =
+            new ResourceKey(getHostName(resource), gangliaClusterName);
+
+        for (String id : ids) {
+          Map<String, PropertyInfo> propertyInfoMap = getPropertyInfoMap(getComponentName(resource),
id);
+
+          for (Map.Entry<String, PropertyInfo> entry : propertyInfoMap.entrySet())
{
+            String propertyId = entry.getKey();
+            PropertyInfo propertyInfo = entry.getValue();
+
+            TemporalInfo temporalInfo = request.getTemporalInfo(id);
+
+            if ((temporalInfo == null && propertyInfo.isPointInTime()) || (temporalInfo
!= null && propertyInfo.isTemporal())) {
+              RRDRequest rrdRequest = requests.get(temporalInfo);
+              if (rrdRequest == null) {
+                rrdRequest = new RRDRequest(clusterName, temporalInfo);
+                requests.put(temporalInfo, rrdRequest);
+              }
+              rrdRequest.putResource(key, resource);
+              rrdRequest.putPropertyId(propertyInfo.getPropertyId(), propertyId);
             }
-            rrdRequest.putResource(key, resource);
-            rrdRequest.putPropertyId(propertyInfo.getPropertyId(), propertyId);
           }
         }
       }

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
Wed Jan 30 12:07:45 2013
@@ -140,7 +140,7 @@ public class GangliaPropertyProviderTest
 
     Assert.assertEquals(3, propertyProvider.populateResources(resources, request, null).size());
 
-    Assert.assertEquals("http://domU-12-31-39-0E-34-E1.compute-1.internal/cgi-bin/rrd.py?c=HDPSlaves&h=domU-12-31-39-0E-34-E3.compute-1.internal,domU-12-31-39-0E-34-E1.compute-1.internal,domU-12-31-39-0E-34-E2.compute-1.internal&m=jvm.metrics.gcCount&s=10&e=20&r=1",
+    Assert.assertEquals("http://domU-12-31-39-0E-34-E1.compute-1.internal/cgi-bin/rrd.py?c=HDPJobTracker,HDPHBaseMaster,HDPSlaves,HDPNameNode&h=domU-12-31-39-0E-34-E3.compute-1.internal,domU-12-31-39-0E-34-E1.compute-1.internal,domU-12-31-39-0E-34-E2.compute-1.internal&m=jvm.metrics.gcCount&s=10&e=20&r=1",
         streamProvider.getLastSpec());
 
     for (Resource res : resources) {

Modified: incubator/ambari/trunk/ambari-server/src/test/resources/temporal_ganglia_data.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/resources/temporal_ganglia_data.txt?rev=1440365&r1=1440364&r2=1440365&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/resources/temporal_ganglia_data.txt (original)
+++ incubator/ambari/trunk/ambari-server/src/test/resources/temporal_ganglia_data.txt Wed
Jan 30 12:07:45 2013
@@ -307,7 +307,7 @@ jvm.metrics.gcCount
 115576389.233
 [AMBARI_DP_END]
 sum
-HDPSlaves
+HDPNameNode
 domU-12-31-39-0E-34-E3.compute-1.internal
 jvm.metrics.gcCount
 1358434800



Mime
View raw message