Github user sachingoel0101 commented on a diff in the pull request:
https://github.com/apache/flink/pull/1236#discussion_r41618643
--- Diff:
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/TaskManagersHandler.java
---
@@ -54,10 +58,22 @@ public String handleRequest(Map<String, String> params)
throws Exception {
ActorGateway jobManager =
retriever.getJobManagerGateway();
if (jobManager != null) {
- Future<Object> future =
jobManager.ask(JobManagerMessages.getRequestRegisteredTaskManagers(), timeout);
- RegisteredTaskManagers taskManagers =
(RegisteredTaskManagers) Await.result(future, timeout);
-
- final List<Instance> instances = new
ArrayList<Instance>(taskManagers.asJavaCollection());
+ // whether one task manager's metrics are
requested, or all task manager, we
+ // return them in an array. This avoids
unnecessary code complexity.
+ // If only one task manager is requested, we
only fetch one task manager metrics.
+ final List<Instance> instances = new
ArrayList<>();
+ if (params.containsKey(TASK_MANAGER_ID_KEY)) {
+ InstanceID instanceID = new
InstanceID(StringUtils.hexStringToByte(params.get(TASK_MANAGER_ID_KEY)));
+ Future<Object> future =
jobManager.ask(new JobManagerMessages.RequestTaskManagerInstance(instanceID),
timeout);
+ TaskManagerInstance instance =
(TaskManagerInstance) Await.result(future, timeout);
+ if (instance.instance() != null) {
--- End diff --
Will fix this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---