Skip to content

Commit

Permalink
[feat](FE) add rest api to get last profile (apache#38268) (apache#38451
Browse files Browse the repository at this point in the history
)

## Proposed changes
pick from apache#38268

if you want to get the profile of the query just executed, it not
neccessary to find the query_id now.
this is useful to get profiles in shell script, for example, we want to
get all profiles of tpcds queries (103 query profile) in a shell script.

before:
curl

http://root:@127.0.0.1:8030/api/profile/text?query_id=990cc3b19e464e03-a3af05a997eb4091
> profile
after:
curl http://root:@127.0.0.1:8030/api/profile/text > profilex

Issue Number: close #xxx

<!--Describe your changes.-->

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
  • Loading branch information
englefly authored Jul 30, 2024
1 parent 715bcd1 commit 377d461
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ public String getProfile(String queryID) {
}
}

public String getLastQueryId() {
return queryIdDeque.getLast();
}

public String getProfileBrief(String queryID) {
readLock.lock();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected Object profileText(HttpServletRequest request, HttpServletResponse res

String queryId = request.getParameter("query_id");
if (Strings.isNullOrEmpty(queryId)) {
return "Missing query_id";
queryId = ProfileManager.getInstance().getLastQueryId();
}

String queryProfileStr = ProfileManager.getInstance().getProfile(queryId);
Expand Down

0 comments on commit 377d461

Please sign in to comment.