Repository: incubator-slider Updated Branches: refs/heads/develop 8db0e07df -> fa4242a5a
SLIDER-1210 Expose diagnostics information of a running app in ApplicationMaster UI Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/fa4242a5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/fa4242a5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/fa4242a5 Branch: refs/heads/develop Commit: fa4242a5a5209792b3491624694597fa263c314f Parents: 8db0e07 Author: Gour Saha <gourks...@apache.org> Authored: Thu Feb 16 00:34:56 2017 -0800 Committer: Gour Saha <gourks...@apache.org> Committed: Thu Feb 16 00:34:56 2017 -0800 ---------------------------------------------------------------------- .../rest/SliderApplicationApiRestClient.java | 6 +++++ .../server/appmaster/web/rest/RestPaths.java | 1 + .../rest/application/ApplicationResource.java | 23 +++++++++++++++++--- .../server/appmaster/web/view/NavBlock.java | 3 ++- 4 files changed, 29 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa4242a5/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java index 4283ee8..46f2b54 100644 --- a/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java +++ b/slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java @@ -26,6 +26,7 @@ import com.sun.jersey.api.client.UniformInterfaceException; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.representation.Form; import org.apache.commons.lang.StringUtils; +import org.apache.slider.api.types.ApplicationDiagnostics; import org.apache.slider.api.types.ApplicationLivenessInformation; import org.apache.slider.api.types.ComponentInformation; import org.apache.slider.api.types.ContainerInformation; @@ -323,4 +324,9 @@ public class SliderApplicationApiRestClient extends BaseRestClient return getApplicationResource(LIVE_LIVENESS, ApplicationLivenessInformation.class); } + + public ApplicationDiagnostics getApplicationDiagnostics() throws IOException { + return getApplicationResource(LIVE_DIAGNOSTICS, + ApplicationDiagnostics.class); + } } http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa4242a5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java index ae9eb0f..fe88efd 100644 --- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java +++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/RestPaths.java @@ -145,6 +145,7 @@ public class RestPaths { public static final String LIVE_COMPONENTS = "/live/components"; public static final String LIVE_NODES = "/live/nodes"; public static final String LIVE_LIVENESS = "/live/liveness"; + public static final String LIVE_DIAGNOSTICS = "/live/diagnostics"; public static final String LIVE_STATISTICS = "/live/statistics"; public static final String MODEL = "/model"; public static final String MODEL_DESIRED = MODEL +"/desired"; http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa4242a5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java index 52068d6..c6d2dce 100644 --- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java +++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/application/ApplicationResource.java @@ -22,6 +22,7 @@ import com.google.common.collect.Lists; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.webapp.BadRequestException; import org.apache.hadoop.yarn.webapp.NotFoundException; +import org.apache.slider.api.types.ApplicationDiagnostics; import org.apache.slider.api.types.ApplicationLivenessInformation; import org.apache.slider.api.types.ComponentInformation; import org.apache.slider.api.types.ContainerInformation; @@ -324,6 +325,22 @@ public class ApplicationResource extends AbstractSliderResource { } } + /** + * Diagnostics of the application as a whole. + * @return snapshot of diagnostics + */ + @GET + @Path(LIVE_DIAGNOSTICS) + @Produces({APPLICATION_JSON}) + public ApplicationDiagnostics getApplicationDiagnostics() { + markGet(SLIDER_SUBPATH_APPLICATION, LIVE_DIAGNOSTICS); + try { + return state.getApplicationDiagnostics(); + } catch (Exception e) { + throw buildException(LIVE_CONTAINERS, e); + } + } + /* TODO: decide what structure to return here, then implement @@ -352,7 +369,7 @@ TODO: decide what structure to return here, then implement @Path(LIVE_NODES) @Produces({APPLICATION_JSON}) public NodeInformationList getLiveNodes() { - markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS); + markGet(SLIDER_SUBPATH_APPLICATION, LIVE_NODES); try { return (NodeInformationList) cache.lookup(LIVE_NODES); } catch (Exception e) { @@ -364,7 +381,7 @@ TODO: decide what structure to return here, then implement @Path(LIVE_NODES + "/{hostname}") @Produces({APPLICATION_JSON}) public NodeInformation getLiveNode(@PathParam("hostname") String hostname) { - markGet(SLIDER_SUBPATH_APPLICATION, LIVE_COMPONENTS); + markGet(SLIDER_SUBPATH_APPLICATION, LIVE_NODES); try { NodeInformation ni = state.getNodeInformation(hostname); if (ni != null) { @@ -387,7 +404,7 @@ TODO: decide what structure to return here, then implement @Path(LIVE_STATISTICS) @Produces({APPLICATION_JSON}) public Map<String, Integer> getLiveStatistics() { - markGet(SLIDER_SUBPATH_APPLICATION, LIVE_LIVENESS); + markGet(SLIDER_SUBPATH_APPLICATION, LIVE_STATISTICS); try { return (Map<String, Integer>) cache.lookup(LIVE_STATISTICS); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/fa4242a5/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java index 069d386..5bdbb98 100644 --- a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java +++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/view/NavBlock.java @@ -54,7 +54,8 @@ public class NavBlock extends SliderHamletBlock { li().a(apiPath(LIVE_CONTAINERS), "Containers")._(). li().a(apiPath(LIVE_NODES), "Nodes")._(). li().a(apiPath(LIVE_STATISTICS), "Statistics")._(). - li().a(apiPath(LIVE_LIVENESS), "Liveness")._() + li().a(apiPath(LIVE_LIVENESS), "Liveness")._(). + li().a(apiPath(LIVE_DIAGNOSTICS), "Diagnostics")._() ._() ._(); }