Skip to content
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

[data.search.session] Use locators instead of URL generators #115681

Merged
merged 12 commits into from
Oct 26, 2021

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Oct 19, 2021

Summary

Resolves #85126.

Migrates the search session service from URL generators to locators.

To do:

  • Migration of saved object
  • Fix/update tests
  • Update docs

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@lukasolson lukasolson added v8.0.0 Team:AppServicesSv release_note:skip Skip the PR/issue when compiling release notes auto-backport Deprecated - use backport:version if exact versions are needed Feature:Search Sessions labels Oct 19, 2021
@lukasolson lukasolson self-assigned this Oct 19, 2021
try {
url = await urls.getUrlGenerator(urlGeneratorId).createUrl(state);
const locator = locators.get(locatorId);
return locator?.getRedirectUrl(state);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave it like this in this migration pr, but I think later we should use locator.navigate instead. I assume this will solve the potential problem of "too long URLs"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I had this same thought... I just did this for now since it was simpler but is there any reason we shouldn't use navigate in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason we shouldn't use navigate in this PR?

I think mostly because this will require destination apps to be able to handle incoming state: now they only can extract the initial state from the URL, but they will have to extract it from location.state.
So as this will require more changes and more testing, I suggest we focus on migration and use an old URL based approach for now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this bug with redirect endpoint - #116313. I think it is fine to fix separately

@Dosant
Copy link
Contributor

Dosant commented Oct 20, 2021

Could you please also update relevant docs: https://github.com/elastic/kibana/blob/master/dev_docs/tutorials/data/search.mdx

@lukasolson lukasolson marked this pull request as ready for review October 21, 2021 22:54
@lukasolson lukasolson requested review from a team as code owners October 21, 2021 22:54
@lukasolson lukasolson changed the title [skip-ci] [data.search.session] Use locators instead of URL generators [data.search.session] Use locators instead of URL generators Oct 21, 2021
Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code only review - nice change! The more we use locators the better! Presentation team changes LGTM

@lukasolson lukasolson requested a review from Dosant October 25, 2021 20:17
@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discover changes approved!

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested search sessions in Discover/Dashboard. Didn't notice any issues.

I also tested an upgrade from 7.16 to 8.0. all seems good 👍
nice work

@@ -164,3 +165,193 @@ describe('7.13.0 -> 7.14.0', () => {
`);
});
});

describe('7.14.0 -> 7.18.0', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

try {
url = await urls.getUrlGenerator(urlGeneratorId).createUrl(state);
const locator = locators.get(locatorId);
return locator?.getRedirectUrl(state);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this bug with redirect endpoint - #116313. I think it is fine to fix separately

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 143.3KB 143.3KB -11.0B
dataEnhanced 46.6KB 46.6KB -5.0B
discover 340.0KB 340.0KB -6.0B
total -22.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 468.3KB 468.3KB -32.0B
discover 22.7KB 22.9KB +193.0B
total +161.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lukasolson

@lukasolson lukasolson merged commit eb74b86 into elastic:master Oct 26, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

The backport operation could not be completed due to the following error:
There are no branches to backport to. Aborting.

The backport PRs will be merged automatically after passing CI.

To backport manually run:
node scripts/backport --pr 115681

@lukasolson lukasolson removed the auto-backport Deprecated - use backport:version if exact versions are needed label Oct 26, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 115681 or prevent reminders by adding the backport:skip label.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 28, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 115681 or prevent reminders by adding the backport:skip label.

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 115681 or prevent reminders by adding the backport:skip label.

@lukasolson lukasolson added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Nov 1, 2021
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 2, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 115681 or prevent reminders by adding the backport:skip label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Search Sessions release_note:skip Skip the PR/issue when compiling release notes v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Search Session] Use new URL Service for session restoration
5 participants