-
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
[Search] Search Sessions with relative time range #84405
Conversation
42fd29a
to
a13e3ce
Compare
@elasticmachine merge upstream |
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.
/** | ||
* Used to synchronize time between parallel searches with relative time range that rely on `now`. | ||
*/ | ||
export class NowProvider { |
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 am wondering why is this not part of session service ? i would expect that when creating a session its 'fixed in time' by converting the relative time to absolute.
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.
It is not part of session service because it is also includes functionality the previously was part of time filter about getting now from the URL (so not only session can control "now"):
https://github.com/elastic/kibana/pull/84405/files/c92374a20f65fe24447bdef8c5b1dbf8c94dfeec#diff-fe41d6d47fbb6465cde6d519ae701f58b0259c89ecf3779048a49651a43b6276R29
import { parse } from 'query-string'; | ||
|
||
/** @internal */ | ||
export function parseQueryString() { | ||
export function getForceNowFromUrl(): Date | undefined { |
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 moved from timefilter
to this new nowProvider
Long term we should make apps responsible for getting this from the URL and setting it into nowProvider
Pinging @elastic/kibana-app-services (Team:AppServices) |
@elasticmachine merge upstream |
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'm not vastly familiar with the code that is changed in this PR. My takeaway is the motivation seems to add a new contract called NowProvider
.
we already had some forceNow logic for reporting. So some conversions could be missed and I am happy to follow on that
I'm not sure what you mean by "conversions could be missed". [1]
Can you add more info about what NowProvider
is and how an app should use it? Also talk about what conversions you worked on in this PR to help clarify my understanding about [1].
923baf9
to
05b927f
Compare
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.
Reviewed the code thoroughly and tested the things I could think.
LGTM.
…lative-timerange # Conflicts: # src/plugins/data/public/public.api.md # src/plugins/data/public/search/session/search_session_state.ts # src/plugins/data/public/search/session/session_service.test.ts
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.
Code review only: Presentation team changes LGTM. Can't wait to see these changes in by default!
@@ -169,6 +169,11 @@ export function DashboardApp({ | |||
setLastReloadTime(() => new Date().getTime()); | |||
}) | |||
); | |||
subscriptions.add( | |||
data.query.timefilter.timefilter.getAutoRefreshFetch$().subscribe(() => { |
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: We already have a shortcut const for timefilter declared above. It also might be a bit cleaner to merge the two subs that do the same thing:
subscriptions.add(
merge(data.search.session.onRefresh$, timeFilter.getAutoRefreshFetch$()).subscribe(() =>
setLastReloadTime(() => new Date().getTime())
)
);
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.
Improved 👍
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
Kibana app code review changes LGTM.
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
Part of #83640
In master background session restoration works only for absolute time ranges.
This pr attempts to make it work for relative time ranges, by "syncing" Date.now() between different searches when relative time range is converted into absolute time range.
Relative to absolute time conversion is not centralized even though we already had some
forceNow
logic for reporting. So some conversions could be missed and I am happy to follow on thatNowProvider
is introduced in data services which keeps tracked of currentnow
value. When session is startedsessionService
sets a newnow
intoNowProvider
so all subsequent searches using it for converting from relative to absolute time range:high-level diagram
In future instead of using
now
for converting just time filter we would explore using point at time apiThere was an edge case with auto refresh. Previously new session wasn't created on auto refresh fetches and with new approach it would cause the same
now
for all refreshes. Now new sessions are created on auto refresh fetches. For this autoRefresh subscription was moved on a dashboard level and removed from embeddable layer. #84405How to test
searchSessionId
from any of inspector. Get absolute time range from any of inspectors.${dashboardURL}&searchSessionId=${searchSessionId}
and replace relative time range with copied time range^^ this is what functional test doest
Demo
I took this pr + #81707 to record this demo:
demo_720.mov
Use this branch to try it yourself: https://github.com/Dosant/kibana/tree/feature/data/management-ui-plus
Checklist
For maintainers