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] Move background session service to data enhanced plugin #84837

Merged
merged 9 commits into from
Dec 7, 2020

Conversation

lukasolson
Copy link
Member

Summary

Requires #84715.

This PR moves the majority of background sessions support to the data_enhanced plugin so that we can, in a follow-up PR, add support for integrating with security.

As part of this effort, the following changes were made:

An OSS SessionService was introduced, that simply invokes the corresponding SearchStrategy. The BackgroundSessionService was moved to data_enhanced, as well as the registering of the saved object type as well as routes that handle managing the saved objects.

The SessionService now also manages its own dependencies rather than expecting them to be passed in as part of the search method in the SearchService.

Checklist

Delete any items that are not applicable to this PR.

@lukasolson lukasolson added review Feature:Search Querying infrastructure in Kibana v8.0.0 Team:AppServices release_note:skip Skip the PR/issue when compiling release notes v7.11.0 Project:AsyncSearch Background search, partial results, async search services. labels Dec 2, 2020
@lukasolson lukasolson self-assigned this Dec 2, 2020
@lukasolson lukasolson requested a review from a team as a code owner December 2, 2020 21:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServices)

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Dec 2, 2020
@@ -37,7 +36,7 @@ export class SessionsClient {
this.http = deps.http;
}

public get(sessionId: string): Promise<SavedObject<BackgroundSessionSavedObjectAttributes>> {
Copy link
Member Author

Choose a reason for hiding this comment

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

@Dosant, you'll noticed I removed references to the BackgroundSession stuff here since it was moved to xpack. The corresponding routes are also now only available in Basic+, which probably means this file would make more sense being moved to xpack, but I'm not exactly sure how you want to go about it. Do you have any thoughts about it?

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 move those to x-pack too

Copy link
Contributor

@Dosant Dosant Dec 7, 2020

Choose a reason for hiding this comment

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

I think we can move session_client implementation into x-pack but will have to leave interface in OSS (decoupled from BackgroundSessionSavedObjectAttributes).

But I don't think we should move sessionService into x-pack because of how OSS apps rely on it.

If you agree, please be free to open an issue and assign on me.

@lizozom lizozom mentioned this pull request Dec 3, 2020
8 tasks
Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

Overall LGTM once green.
I wonder if we want to offer a more similar API on OSS\Xpack, with the OSS functions returning a falsy value (or an error?).

@@ -55,8 +56,12 @@ export class EnhancedDataServerPlugin implements Plugin<void, void, SetupDepende
deps.data.__enhance({
search: {
defaultStrategy: ENHANCED_ES_SEARCH_STRATEGY,
sessionService: new BackgroundSessionService(),
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

@@ -109,7 +106,7 @@ export class SearchService implements Plugin<ISearchSetup, ISearchStart> {
private defaultSearchStrategyName: string = ES_SEARCH_STRATEGY;
private searchStrategies: StrategyMap = {};
private coreStart?: CoreStart;
private sessionService: BackgroundSessionService = new BackgroundSessionService();
private sessionService: ISessionService = new SessionService();
Copy link
Contributor

@lizozom lizozom Dec 3, 2020

Choose a reason for hiding this comment

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

Since the server and client types are so different, maybe we should name the types noting they are Client \ Server ?

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

@lizozom
Copy link
Contributor

lizozom commented Dec 6, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 603 600 -3
dataEnhanced 37 40 +3
total -0

Distributable file count

id before after diff
default 46898 47664 +766
oss 27566 27561 -5

Page load bundle

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

id before after diff
data 988.3KB 984.5KB -3.8KB
dataEnhanced 36.0KB 38.8KB +2.8KB
total -1.0KB

History

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

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.

@lukasolson lukasolson merged commit e48e744 into elastic:master Dec 7, 2020
lukasolson added a commit to lukasolson/kibana that referenced this pull request Dec 7, 2020
…elastic#84837)

* [data.search] Move search method inside session service and add tests

* Move background session service to data_enhanced plugin

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
lukasolson added a commit that referenced this pull request Dec 7, 2020
…#84837) (#85152)

* [data.search] Move search method inside session service and add tests

* Move background session service to data_enhanced plugin

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@@ -55,7 +54,7 @@ export class SessionsClient {
restoreState: Record<string, unknown>;
urlGeneratorId: string;
sessionId: string;
}): Promise<SavedObject<BackgroundSessionSavedObjectAttributes>> {
}): Promise<SavedObject> {
Copy link
Member

Choose a reason for hiding this comment

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

Is the intention to use this client in the sessions management UI?

I can do that, but it looks like the client methods are less type-aware after this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Embedding Embedding content via iFrame Feature:Search Querying infrastructure in Kibana Project:AsyncSearch Background search, partial results, async search services. release_note:skip Skip the PR/issue when compiling release notes review v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants