This is an automated email from the ASF dual-hosted git repository. abstractdog pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new 01a29215242 HIVE-27184: Add class name profiling option in ProfileServlet. (#4196) (Dmitriy Fingerman reviewed by Rajesh Balamohan) 01a29215242 is described below commit 01a29215242e63a5fcbc1de4c4518772ba248cb8 Author: Dmitriy Fingerman <dmitriy.finger...@gmail.com> AuthorDate: Wed Apr 5 14:34:43 2023 -0400 HIVE-27184: Add class name profiling option in ProfileServlet. (#4196) (Dmitriy Fingerman reviewed by Rajesh Balamohan) --- common/src/java/org/apache/hive/http/ProfileServlet.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/src/java/org/apache/hive/http/ProfileServlet.java b/common/src/java/org/apache/hive/http/ProfileServlet.java index 6da23e66a34..c2ff2712938 100644 --- a/common/src/java/org/apache/hive/http/ProfileServlet.java +++ b/common/src/java/org/apache/hive/http/ProfileServlet.java @@ -42,6 +42,7 @@ import com.google.common.base.Joiner; * // -i interval sampling interval in nanoseconds (long) * // -j jstackdepth maximum Java stack depth (integer) * // -b bufsize frame buffer size (long) + * // -m method fully qualified method name: 'ClassName.methodName' * // -t profile different threads separately * // -s simple class names instead of FQN * // -o fmt[,fmt...] output format: summary|traces|flat|collapsed|svg|tree|jfr @@ -194,6 +195,14 @@ public class ProfileServlet extends HttpServlet { final Integer height = getInteger(req, "height", null); final Double minwidth = getMinWidth(req); final boolean reverse = req.getParameterMap().containsKey("reverse"); + final String method = req.getParameter("method"); + + if (req.getParameter("event") != null && method != null) { + resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); + setResponseHeader(resp); + resp.getWriter().write("Event and method aren't allowed to be both used in the same request."); + return; + } if (process == null || !process.isAlive()) { try { @@ -201,12 +210,12 @@ public class ProfileServlet extends HttpServlet { if (profilerLock.tryLock(lockTimeoutSecs, TimeUnit.SECONDS)) { try { File outputFile = new File(OUTPUT_DIR, "async-prof-pid-" + pid + "-" + - event.name().toLowerCase() + "-" + ID_GEN.incrementAndGet() + "." + + (method == null ? event.name().toLowerCase() : method) + "-" + ID_GEN.incrementAndGet() + "." + output.name().toLowerCase()); List<String> cmd = new ArrayList<>(); cmd.add(asyncProfilerHome + PROFILER_SCRIPT); cmd.add("-e"); - cmd.add(event.getInternalName()); + cmd.add(method == null ? event.getInternalName() : method); cmd.add("-d"); cmd.add("" + duration); cmd.add("-o");