-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor search session status on-the-fly calculation and other fixes #136296
Refactor search session status on-the-fly calculation and other fixes #136296
Conversation
…astic/kibana into d/2022-07-11-search-sessions-status-refactor
return options; | ||
}, []), | ||
options: [...new Set(tableData.map((data) => data.appId ?? 'unknown'))] | ||
.sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After fixing sort order for the find
some UI session tests started failing. They failed because the order of this option has changed. I fixed it by starting sorting the options to make them consistent. Also slightly refactored the function
|
||
// initial data load | ||
useEffect(() => { | ||
doRefresh(); | ||
searchUsageCollector.trackSessionsListLoaded(); | ||
}, [doRefresh, searchUsageCollector]); | ||
|
||
useInterval(doRefresh, refreshInterval); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improvements to fetching on the management screen:
- By default disable auto-refresh
- useInterval was refactored to a setTimeout, so that we had control of scheduling a new timeout only after ongoing refresh completes.
- Also added a shortcut
if (document.visibilityState !== 'hidden') {
to skip refresh in case page is not visible.
@@ -141,7 +126,7 @@ export class SearchSessionsMgmtAPI { | |||
page: 1, | |||
perPage: mgmtConfig.maxSessions, | |||
sortField: 'created', | |||
sortOrder: 'asc', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was a mistake. We fetched all sessions and did client-side sorting. Since we changed the default max count from 10000 to 100 we need to properly sort in es
|
||
router.get( | ||
{ | ||
path: '/internal/session/{id}/status', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used only in api tests. this is instead checkStatus
param in get
because I think this is clearer and doesn't argument saved object response
Pinging @elastic/kibana-app-services (Team:AppServicesSv) |
…astic/kibana into d/2022-07-11-search-sessions-status-refactor
public readonly disableSaveAfterSessionCompleteTimedOut$ = | ||
this._disableSaveAfterSessionCompleteTimedOut$.asObservable(); | ||
|
||
private readonly _disableSaveAfterSessionContinuedFromDifferentApp$ = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See description why I think we have to add this new disable condition
@elasticmachine merge upstream |
…1-search-sessions-status-refactor
…astic/kibana into d/2022-07-11-search-sessions-status-refactor
….com:Dosant/kibana into d/2022-07-11-search-sessions-status-refactor
@@ -266,10 +277,27 @@ export class SearchInterceptor { | |||
}) | |||
: undefined; | |||
|
|||
// track if this search's session will be send to background | |||
// if yes, then we don't need to cancel this search when it is aborted | |||
let isSavedToBackground = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While unskipping the remaining tests, I realized that this older implementation from main had some benefits. So I decided to get it back and unskip related tests
buildlkite, test this |
buildkite, test this |
💔 Build FailedFailed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Canvas Sharable Runtime
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for walking me through these changes, LGTM
/** | ||
* Map containing calculated statuses of search sessions from the find response | ||
*/ | ||
statuses: Record<string, SearchSessionStatusResponse>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Instead of something like savedObjects: [...], statuses: [...]
I think it would be easier to use if it were more like searchSessions: [{savedObject: {...}, status: 'status'}]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion 👍
I'll take a look if it is worth update,
I think I didn't go this route initially because we use SavedObjectFindResponse
with a bunch of other properties, and instead of just extending it, I'd had to deep update it
Summary
status
field in a saved object, return it as part of a separate map infind
APIget
API, use separatestatus
API