ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-9282. Update Slider View to consume metrics from AMS (Ambari Metrics Service) - Adding App Name (Gour Saha via srimanth)
Date Tue, 03 Mar 2015 17:43:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 2a2458d6e -> 71c73dc8a


AMBARI-9282. Update Slider View to consume metrics from AMS (Ambari Metrics Service) - Adding
App Name (Gour Saha via srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/71c73dc8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/71c73dc8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/71c73dc8

Branch: refs/heads/branch-2.0.0
Commit: 71c73dc8adea2896f8581b004b4ef188864e0bee
Parents: 2a2458d
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Tue Mar 3 09:42:32 2015 -0800
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Tue Mar 3 09:42:37 2015 -0800

----------------------------------------------------------------------
 .../slider/SliderAppsViewControllerImpl.java     |  5 +++--
 .../rest/client/SliderAppMasterClient.java       |  5 +++--
 .../rest/client/SliderAppMetricsHelper.java      | 19 +++++++++++++------
 3 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/71c73dc8/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index ce36b57..3b74239 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -783,8 +783,9 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController
{
           String metricsUrl = quickLinks.get(METRICS_API_NAME);
           MetricsHolder metricsHolder = appMetrics.get(matchedAppType
               .uniqueName());
-          app.setMetrics(sliderAppClient.getMetrics(metricsUrl,
-              metrics, null, viewContext, matchedAppType, metricsHolder));
+          app.setMetrics(sliderAppClient.getMetrics(yarnApp.getName(),
+              metricsUrl, metrics, null, viewContext, matchedAppType,
+              metricsHolder));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/71c73dc8/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMasterClient.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMasterClient.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMasterClient.java
index 001036c..7393d65 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMasterClient.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMasterClient.java
@@ -157,7 +157,8 @@ public class SliderAppMasterClient extends BaseHttpClient {
     return configsMap;
   }
 
-  public Map<String, Number[][]> getMetrics(String metricsUrl,
+  public Map<String, Number[][]> getMetrics(String appName,
+                                            String metricsUrl,
                                             Set<String> metricsRequested,
                                             TemporalInfo temporalInfo,
                                             ViewContext context,
@@ -194,7 +195,7 @@ public class SliderAppMasterClient extends BaseHttpClient {
     if (metricsToRead.size() != 0) {
       try {
         String specWithParams = SliderAppMetricsHelper.getUrlWithParams(
-            metricsUrl, metricsToRead, temporalInfo);
+            appName, metricsUrl, metricsToRead, temporalInfo);
         logger.info("Using spec: " + specWithParams);
         if (specWithParams != null) {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/71c73dc8/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMetricsHelper.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMetricsHelper.java
b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMetricsHelper.java
index ee823a9..658ee37 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMetricsHelper.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/SliderAppMetricsHelper.java
@@ -42,6 +42,10 @@ public class SliderAppMetricsHelper {
       .getLogger(SliderAppMetricsHelper.class);
   private static ObjectMapper mapper;
   private final static ObjectReader timelineObjectReader;
+  private final static String URI_PARAM_APP_ID = "appId";
+  private final static String URI_PARAM_METRIC_NAMES = "metricNames";
+  private final static String URI_PARAM_START_TIME = "startTime";
+  private final static String URI_PARAM_END_TIME = "endTime";
 
   static {
     mapper = new ObjectMapper();
@@ -108,30 +112,33 @@ public class SliderAppMetricsHelper {
     return metricValues;
   }
 
-  public static String getUrlWithParams(String metricUrl,
+  public static String getUrlWithParams(String appName, String metricUrl,
       Set<String> metricSet, TemporalInfo temporalInfo) throws SystemException,
       URISyntaxException {
     String metrics = getSetString(metricSet, -1);
     URIBuilder uriBuilder = new URIBuilder(metricUrl);
 
+    if (appName != null) {
+      uriBuilder.setParameter(URI_PARAM_APP_ID, appName);
+    }
     if (metrics.length() > 0) {
-      uriBuilder.setParameter("metricNames", metrics);
+      uriBuilder.setParameter(URI_PARAM_METRIC_NAMES, metrics);
     }
 
     if (temporalInfo != null) {
       long startTime = temporalInfo.getStartTime();
       if (startTime != -1) {
-        uriBuilder.setParameter("startTime", String.valueOf(startTime));
+        uriBuilder.setParameter(URI_PARAM_START_TIME, String.valueOf(startTime));
       }
       long endTime = temporalInfo.getEndTime();
       if (endTime != -1) {
-        uriBuilder.setParameter("endTime", String.valueOf(endTime));
+        uriBuilder.setParameter(URI_PARAM_END_TIME, String.valueOf(endTime));
       }
     } else {
       long endTime = System.currentTimeMillis() / 1000;
       long startTime = System.currentTimeMillis() / 1000 - 60 * 60;
-      uriBuilder.setParameter("endTime", String.valueOf(endTime));
-      uriBuilder.setParameter("startTime", String.valueOf(startTime));
+      uriBuilder.setParameter(URI_PARAM_END_TIME, String.valueOf(endTime));
+      uriBuilder.setParameter(URI_PARAM_START_TIME, String.valueOf(startTime));
     }
     return uriBuilder.toString();
   }


Mime
View raw message