Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/en/docs/admin-manual/http-actions/fe/profile-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ under the License.
## Request

`GET /api/profile`
`GET /api/profile/text`

## Description

Expand Down Expand Up @@ -119,6 +120,7 @@ Query:
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```
If it is a text interface, simply return the plain text content of the profile.

## Path parameters

Expand Down Expand Up @@ -164,3 +166,24 @@ None
"count": 0
}
```
2. Get the query profile text of the specified query id
```
GET /api/profile/text?query_id=f732084bc8e74f39-8313581c9c3c0b58

Response:
Summary:
- Profile ID: 48bdf6d75dbb46c9-998b9c0368f4561f
- Task Type: QUERY
- Start Time: 2023-12-20 11:09:41
- End Time: 2023-12-20 11:09:45
- Total: 3s680ms
- Task State: EOF
- User: root
- Default Db: tpcds
- Sql Statement: with customer_total_return as
select sr_customer_sk as ctr_customer_sk
,sr_store_sk as ctr_store_sk
,sum(SR_FEE) as ctr_total_return
...
```

23 changes: 23 additions & 0 deletions docs/zh-CN/docs/admin-manual/http-actions/fe/profile-action.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ under the License.
## Request

`GET /api/profile`
`GET /api/profile/text`

## Description

Expand Down Expand Up @@ -119,6 +120,7 @@ Query:
- BlockConvertTime: 97.539us
- BlockSeekCount: 0
```
如果为text接口,直接返回profile的纯文本内容

## Path parameters

Expand Down Expand Up @@ -164,3 +166,24 @@ Query:
"count": 0
}
```
2. 获取指定 query_id 的 query profile 的纯文本
```
GET /api/profile/text?query_id=f732084bc8e74f39-8313581c9c3c0b58

Response:
Summary:
- Profile ID: 48bdf6d75dbb46c9-998b9c0368f4561f
- Task Type: QUERY
- Start Time: 2023-12-20 11:09:41
- End Time: 2023-12-20 11:09:45
- Total: 3s680ms
- Task State: EOF
- User: root
- Default Db: tpcds
- Sql Statement: with customer_total_return as
select sr_customer_sk as ctr_customer_sk
,sr_store_sk as ctr_store_sk
,sum(SR_FEE) as ctr_total_return
...
```

Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,22 @@ protected Object profile(HttpServletRequest request, HttpServletResponse respons
result.put("profile", queryProfileStr);
return ResponseEntityBuilder.ok(result);
}

@RequestMapping(path = "/api/profile/text", method = RequestMethod.GET)
protected Object profileText(HttpServletRequest request, HttpServletResponse response) {
executeCheckPassword(request, response);
checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), PrivPredicate.ADMIN);

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

String queryProfileStr = ProfileManager.getInstance().getProfile(queryId);
if (queryProfileStr == null) {
return "query id " + queryId + " not found";
}

return queryProfileStr;
}
}