This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new a6fc082e1de [feat](FE) add rest api to get last profile #38268 (#38450)
a6fc082e1de is described below

commit a6fc082e1defdea6710b2bbd5253ccc8847cfa8a
Author: minghong <engle...@gmail.com>
AuthorDate: Wed Jul 31 16:34:24 2024 +0800

    [feat](FE) add rest api to get last profile #38268 (#38450)
    
    pick from master #38268
---
 .../src/main/java/org/apache/doris/common/util/ProfileManager.java    | 4 ++++
 .../src/main/java/org/apache/doris/httpv2/rest/ProfileAction.java     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java
index 1a544583bed..a4694c6fc5e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java
@@ -379,4 +379,8 @@ public class ProfileManager {
             writeLock.unlock();
         }
     }
+
+    public String getLastQueryId() {
+        return queryIdDeque.getLast();
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ProfileAction.java 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ProfileAction.java
index e5679e32caa..296c98e0d70 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ProfileAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ProfileAction.java
@@ -49,7 +49,7 @@ public class ProfileAction extends RestBaseController {
 
         String queryId = request.getParameter("query_id");
         if (Strings.isNullOrEmpty(queryId)) {
-            return ResponseEntityBuilder.badRequest("Missing query_id");
+            queryId = ProfileManager.getInstance().getLastQueryId();
         }
 
         String queryProfileStr = 
ProfileManager.getInstance().getProfile(queryId);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to