HBASE-26657 ProfileServlet should move the output location to hbase specific directory (#4022)

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
This commit is contained in:
Viraj Jasani 2022-01-11 15:59:44 +05:30
parent 2a42e8ed7a
commit de84082391
No known key found for this signature in database
GPG Key ID: 08E70F70AB71C5A1
2 changed files with 4 additions and 4 deletions

View File

@ -787,10 +787,10 @@ public class HttpServer implements FilterContainer {
if (Files.notExists(tmpDir)) { if (Files.notExists(tmpDir)) {
Files.createDirectories(tmpDir); Files.createDirectories(tmpDir);
} }
ServletContextHandler genCtx = new ServletContextHandler(contexts, "/prof-output"); ServletContextHandler genCtx = new ServletContextHandler(contexts, "/prof-output-hbase");
genCtx.addServlet(ProfileOutputServlet.class, "/*"); genCtx.addServlet(ProfileOutputServlet.class, "/*");
genCtx.setResourceBase(tmpDir.toAbsolutePath().toString()); genCtx.setResourceBase(tmpDir.toAbsolutePath().toString());
genCtx.setDisplayName("prof-output"); genCtx.setDisplayName("prof-output-hbase");
} else { } else {
addUnprivilegedServlet("prof", "/prof", ProfileServlet.DisabledServlet.class); addUnprivilegedServlet("prof", "/prof", ProfileServlet.DisabledServlet.class);
LOG.info("ASYNC_PROFILER_HOME environment variable and async.profiler.home system property " + LOG.info("ASYNC_PROFILER_HOME environment variable and async.profiler.home system property " +

View File

@ -98,7 +98,7 @@ public class ProfileServlet extends HttpServlet {
private static final String PROFILER_SCRIPT = "/profiler.sh"; private static final String PROFILER_SCRIPT = "/profiler.sh";
private static final int DEFAULT_DURATION_SECONDS = 10; private static final int DEFAULT_DURATION_SECONDS = 10;
private static final AtomicInteger ID_GEN = new AtomicInteger(0); private static final AtomicInteger ID_GEN = new AtomicInteger(0);
static final String OUTPUT_DIR = System.getProperty("java.io.tmpdir") + "/prof-output"; static final String OUTPUT_DIR = System.getProperty("java.io.tmpdir") + "/prof-output-hbase";
enum Event { enum Event {
CPU("cpu"), CPU("cpu"),
@ -269,7 +269,7 @@ public class ProfileServlet extends HttpServlet {
// set response and set refresh header to output location // set response and set refresh header to output location
setResponseHeader(resp); setResponseHeader(resp);
resp.setStatus(HttpServletResponse.SC_ACCEPTED); resp.setStatus(HttpServletResponse.SC_ACCEPTED);
String relativeUrl = "/prof-output/" + outputFile.getName(); String relativeUrl = "/prof-output-hbase/" + outputFile.getName();
resp.getWriter().write( resp.getWriter().write(
"Started [" + event.getInternalName() + "Started [" + event.getInternalName() +
"] profiling. This page will automatically redirect to " + "] profiling. This page will automatically redirect to " +