[ 
https://issues.apache.org/jira/browse/YARN-11823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18063588#comment-18063588
 ] 

ASF GitHub Bot commented on YARN-11823:
---------------------------------------

K0K0V0K commented on code in PR #8123:
URL: https://github.com/apache/hadoop/pull/8123#discussion_r2896670582


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/NMWebServices.java:
##########
@@ -628,6 +634,63 @@ public Response syncYarnSysFS(@javax.ws.rs.core.Context
     return Response.ok().build();
   }
 
+
+  @GET
+  @Path("/jstack/{numberOfJStack}")
+  public Response getNodeThreadDump(@PathParam("numberOfJStack") int 
numberOfJStack)
+  {
+    if (isJStackEndpointsEnable) {
+      try {
+        DiagnosticJStackService diagnosticJStackService = new 
DiagnosticJStackService(this.nmContext);
+        return Response.status(Status.OK)
+                
.entity(diagnosticJStackService.collectNodeThreadDump(numberOfJStack))
+                .build();
+      } catch (IOException e){
+        throw new WebAppException("Shell command has failed: " + 
e.getMessage() + ". " +
+                "For more information please check the NodeManager logs.");
+      } catch (Exception e) {
+        throw new WebAppException(
+                "Unexpected error collection NodeManager JStack: " + 
e.getMessage() + ". " +
+                "For more information please check the NodeManager logs.");
+      }
+    } else {
+      return Response.status(Status.METHOD_NOT_ALLOWED)
+              .build();
+    }
+  }
+
+
+  @GET
+  @Path("/apps/{appid}/jstack/{numberOfJStack}")
+  @Produces({MediaType.TEXT_PLAIN})
+  public Response getApplicationJStack(@PathParam("appid") String appId,
+                                       @PathParam("numberOfJStack") int 
numberOfJStack)
+  {
+    if (isJStackEndpointsEnable) {
+      try {
+        DiagnosticJStackService diagnosticJStackService = new 
DiagnosticJStackService(this.nmContext);

Review Comment:
   This should not be a class level variable?





> New JStack endpoint for running containers and nodes
> ----------------------------------------------------
>
>                 Key: YARN-11823
>                 URL: https://issues.apache.org/jira/browse/YARN-11823
>             Project: Hadoop YARN
>          Issue Type: New Feature
>          Components: yarn
>            Reporter: chhinlinghean
>            Assignee: chhinlinghean
>            Priority: Major
>              Labels: pull-request-available
>
> Getting jstack for container is not trivial to most people. This new endpoint 
> aims to streamline the process of getting jstack of running containers and 
> nodes. It mainly use in the DiagnosticCollector script.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to