Skip to content

Commit

Permalink
[8.x] [ES|QL] Pass the took time to the inspector (#194806) (#194897)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Pass the took time to the inspector
(#194806)](#194806)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-04T05:49:31Z","message":"[ES|QL]
Pass the took time to the inspector (#194806)\n\n## Summary\r\n\r\nNow
that this PR
https://github.com/elastic/elasticsearch/pull/112595\r\nlanded in our
snapshot, we can have the query time in the inspector.\r\n\r\n<img
width=\"798\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1ba1c59e-f094-4a56-964d-d76bdc1db8b3\">\r\n\r\n\r\n<img
width=\"1017\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/48464d7c-60c0-4924-bfcb-85f82b7caa40\">","sha":"2621bb7acbc3809db98a85e5c2ce3bfabc8ee660","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","backport:prev-minor","Feature:ES|QL","Team:ESQL","v8.16.0"],"title":"[ES|QL]
Pass the took time to the
inspector","number":194806,"url":"https://github.com/elastic/kibana/pull/194806","mergeCommit":{"message":"[ES|QL]
Pass the took time to the inspector (#194806)\n\n## Summary\r\n\r\nNow
that this PR
https://github.com/elastic/elasticsearch/pull/112595\r\nlanded in our
snapshot, we can have the query time in the inspector.\r\n\r\n<img
width=\"798\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1ba1c59e-f094-4a56-964d-d76bdc1db8b3\">\r\n\r\n\r\n<img
width=\"1017\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/48464d7c-60c0-4924-bfcb-85f82b7caa40\">","sha":"2621bb7acbc3809db98a85e5c2ce3bfabc8ee660"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194806","number":194806,"mergeCommit":{"message":"[ES|QL]
Pass the took time to the inspector (#194806)\n\n## Summary\r\n\r\nNow
that this PR
https://github.com/elastic/elasticsearch/pull/112595\r\nlanded in our
snapshot, we can have the query time in the inspector.\r\n\r\n<img
width=\"798\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/1ba1c59e-f094-4a56-964d-d76bdc1db8b3\">\r\n\r\n\r\n<img
width=\"1017\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/48464d7c-60c0-4924-bfcb-85f82b7caa40\">","sha":"2621bb7acbc3809db98a85e5c2ce3bfabc8ee660"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <[email protected]>
  • Loading branch information
kibanamachine and stratoula authored Oct 4, 2024
1 parent 8a604f1 commit 18b2b5c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/kbn-es-types/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ export interface ESQLSearchResponse {
// while columns only the available ones (non nulls)
all_columns?: ESQLColumn[];
values: ESQLRow[];
took?: number;
}

export interface ESQLSearchParams {
Expand Down
16 changes: 16 additions & 0 deletions src/plugins/data/common/search/expressions/esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ export const getEsqlFn = ({ getStartDependencies }: EsqlFnArguments) => {
defaultMessage: 'The number of documents returned by the query.',
}),
},
...(rawResponse?.took && {
queryTime: {
label: i18n.translate('data.search.es_search.queryTimeLabel', {
defaultMessage: 'Query time',
}),
value: i18n.translate('data.search.es_search.queryTimeValue', {
defaultMessage: '{queryTime}ms',
values: { queryTime: rawResponse.took },
}),
description: i18n.translate('data.search.es_search.queryTimeDescription', {
defaultMessage:
'The time it took to process the query. ' +
'Does not include the time to send the request or parse it in the browser.',
}),
},
}),
})
.json(params)
.ok({ json: rawResponse, requestParams });
Expand Down

0 comments on commit 18b2b5c

Please sign in to comment.