You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tez.apache.org by GitBox <gi...@apache.org> on 2022/05/31 08:57:54 UTC

[GitHub] [tez] abstractdog commented on a diff in pull request #212: TEZ-4038: Add a /prof profiler endpoint like HiveServer2 has

abstractdog commented on code in PR #212:
URL: https://github.com/apache/tez/pull/212#discussion_r885383247


##########
tez-common/src/main/java/org/apache/tez/common/web/ProfileOutputServlet.java:
##########
@@ -0,0 +1,52 @@
+package org.apache.tez.common.web;
+
+import org.apache.hadoop.yarn.webapp.MimeType;
+import org.eclipse.jetty.servlet.DefaultServlet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class ProfileOutputServlet extends DefaultServlet {
+    public static final String fileQueryParam = "file";
+    public ProfileOutputServlet() {
+
+    }
+    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        String queriedFile = request.getParameter(fileQueryParam);
+        if (queriedFile == null) {
+            response.setContentType(MimeType.TEXT);

Review Comment:
   you can refactor these lines to a single method (message string as parameter) and reuse it below



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@tez.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org