[FLINK-5419] Make full TM metrics available through REST API

This closes #3092.


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

Branch: refs/heads/master
Commit: c93e04c16a7865dbbc90d89799b46f91831e0a55
Parents: a7437cc
Author: zentol <ches...@apache.org>
Authored: Mon Jan 16 14:03:21 2017 +0100
Committer: zentol <ches...@apache.org>
Committed: Thu Jan 19 23:57:21 2017 +0100

----------------------------------------------------------------------
 .../org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java | 2 +-
 .../runtime/webmonitor/metrics/TaskManagerMetricsHandler.java  | 6 +++---
 .../webmonitor/metrics/TaskManagerMetricsHandlerTest.java      | 4 ++--
 .../app/scripts/modules/taskmanager/taskmanager.svc.coffee     | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/c93e04c1/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
----------------------------------------------------------------------
diff --git 
a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
 
b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
index 92c2e36..a9cb630 100644
--- 
a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
+++ 
b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/WebRuntimeMonitor.java
@@ -297,7 +297,7 @@ public class WebRuntimeMonitor implements WebMonitor {
                        .GET("/jobs/:jobid/metrics", handler(new 
JobMetricsHandler(metricFetcher)))
 
                        .GET("/taskmanagers", handler(new 
TaskManagersHandler(DEFAULT_REQUEST_TIMEOUT, metricFetcher)))
-                       .GET("/taskmanagers/:" + 
TaskManagersHandler.TASK_MANAGER_ID_KEY + "/metrics", handler(new 
TaskManagersHandler(DEFAULT_REQUEST_TIMEOUT, metricFetcher)))
+                       .GET("/taskmanagers/:" + 
TaskManagersHandler.TASK_MANAGER_ID_KEY, handler(new 
TaskManagersHandler(DEFAULT_REQUEST_TIMEOUT, metricFetcher)))
                        .GET("/taskmanagers/:" + 
TaskManagersHandler.TASK_MANAGER_ID_KEY + "/log", 
                                new TaskManagerLogHandler(retriever, context, 
jobManagerAddressPromise.future(), timeout,
                                        TaskManagerLogHandler.FileMode.LOG, 
config, enableSSL))

http://git-wip-us.apache.org/repos/asf/flink/blob/c93e04c1/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandler.java
----------------------------------------------------------------------
diff --git 
a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandler.java
 
b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandler.java
index a69b676..f1b2e72 100644
--- 
a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandler.java
+++ 
b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandler.java
@@ -17,6 +17,8 @@
  */
 package org.apache.flink.runtime.webmonitor.metrics;
 
+import org.apache.flink.runtime.webmonitor.handlers.TaskManagersHandler;
+
 import java.util.Map;
 
 /**
@@ -31,15 +33,13 @@ import java.util.Map;
  * {@code [ { "id" : "X", "value" : "S" }, { "id" : "Y", "value" : "T" } ] }
  */
 public class TaskManagerMetricsHandler extends AbstractMetricsHandler {
-       public static final String PARAMETER_TM_ID = "tmid";
-
        public TaskManagerMetricsHandler(MetricFetcher fetcher) {
                super(fetcher);
        }
 
        @Override
        protected Map<String, String> getMapFor(Map<String, String> pathParams, 
MetricStore metrics) {
-               MetricStore.TaskManagerMetricStore taskManager = 
metrics.getTaskManagerMetricStore(pathParams.get(PARAMETER_TM_ID));
+               MetricStore.TaskManagerMetricStore taskManager = 
metrics.getTaskManagerMetricStore(pathParams.get(TaskManagersHandler.TASK_MANAGER_ID_KEY));
                if (taskManager == null) {
                        return null;
                } else {

http://git-wip-us.apache.org/repos/asf/flink/blob/c93e04c1/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandlerTest.java
----------------------------------------------------------------------
diff --git 
a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandlerTest.java
 
b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandlerTest.java
index a410404..12c9f3f 100644
--- 
a/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandlerTest.java
+++ 
b/flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/metrics/TaskManagerMetricsHandlerTest.java
@@ -26,7 +26,7 @@ import scala.concurrent.ExecutionContext;
 import java.util.HashMap;
 import java.util.Map;
 
-import static 
org.apache.flink.runtime.webmonitor.metrics.TaskManagerMetricsHandler.PARAMETER_TM_ID;
+import static 
org.apache.flink.runtime.webmonitor.handlers.TaskManagersHandler.TASK_MANAGER_ID_KEY;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.powermock.api.mockito.PowerMockito.mock;
@@ -40,7 +40,7 @@ public class TaskManagerMetricsHandlerTest extends TestLogger 
{
                TaskManagerMetricsHandler handler = new 
TaskManagerMetricsHandler(fetcher);
 
                Map<String, String> pathParams = new HashMap<>();
-               pathParams.put(PARAMETER_TM_ID, "tmid");
+               pathParams.put(TASK_MANAGER_ID_KEY, "tmid");
 
                Map<String, String> metrics = handler.getMapFor(pathParams, 
store);
 

http://git-wip-us.apache.org/repos/asf/flink/blob/c93e04c1/flink-runtime-web/web-dashboard/app/scripts/modules/taskmanager/taskmanager.svc.coffee
----------------------------------------------------------------------
diff --git 
a/flink-runtime-web/web-dashboard/app/scripts/modules/taskmanager/taskmanager.svc.coffee
 
b/flink-runtime-web/web-dashboard/app/scripts/modules/taskmanager/taskmanager.svc.coffee
index ec8bcc0..8912693 100644
--- 
a/flink-runtime-web/web-dashboard/app/scripts/modules/taskmanager/taskmanager.svc.coffee
+++ 
b/flink-runtime-web/web-dashboard/app/scripts/modules/taskmanager/taskmanager.svc.coffee
@@ -34,7 +34,7 @@ angular.module('flinkApp')
   @loadMetrics = (taskmanagerid) ->
     deferred = $q.defer()
 
-    $http.get(flinkConfig.jobServer + "taskmanagers/" + taskmanagerid + 
"/metrics")
+    $http.get(flinkConfig.jobServer + "taskmanagers/" + taskmanagerid)
     .success (data, status, headers, config) ->
       deferred.resolve(data['taskmanagers'])
 

Reply via email to