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

[SearchProfiler] Move out of legacy #55331

Merged

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Jan 20, 2020

Summary

Continuation of #48795

This is the final step which moves Searchprofiler on to New Platform (NP) proper.

How to review

  • I would recommend looking mainly at public/plugin.ts and server/plugin.ts. Most important changes are there - how the plugin starts up and the services it uses.
  • Could be helpful to have a second local copy of the kibana repo so that you can use git-diff like git diff --no-index ../current-master/x-pack/watcher/public/np_ready/application ./x-pack/plugins/searchprofiler/public/application for a cleaner summary of application specific changes
  • Migrated server side to NP as part of this move out of legacy folder
  • Style (SASS) files are still in legacy for now.

Basic Test plan

  1. With basic license (or higher)
    1. With working query
      1. Run search profile (default). Check that expansion works and that flyout displays correct informtion.
      2. Run aggregation profile
    2. With broken query (e.g., misspell match_all -> matchall). Should report error and location of error in toast
    3. With bad JSON, should prevent request from being submitted
  2. If UI already loaded and license changes
    1. UI should load, but be disabled (i.e., prevent user input)
    2. Server should respond with 403 and message relating to license
  3. If license lower than basic at startup: UI should not load.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- Updated license check to only check for presence of basic license (not search profiler as a feature
- Updated the payload: removed types from validation
- Also added README in public regarding the location of styles
@jloleysens jloleysens added Feature:Dev Tools release_note:roadmap v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more Feature:Search Profiler v7.7.0 labels Jan 20, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

Awesome work @jloleysens ! I tested locally and everything works as expected.

With lower than basic license
UI should load, but be disabled (i.e., prevent user input)
Server should respond with 403 and message relating to license

When I started in OSS, I actually did not have the searchprofiler at all. How do we test the above scenario?

Screen Shot 2020-01-22 at 15 12 03

* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { LicenseType } from '../../licensing/common/types';
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 it would be good to export from a barrel index.ts at the root of "licensing" pluggin what can be imported elsewhere, in this case the types. WDYT?

[EDIT] From the platform doc "The New Platform only considers values exported from my_plugin/public and my_plugin/server to be stable.". So, in this case, the barrel should be in public and export from the common folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, so that value is being pulled in from the common folder in the licensing plugin. They have marked that type public which is way I am reaching in to that plugin to pull it out.

Perhaps worth opening a question about it to either have licensing explain the reasoning or update the platform doc to cater for values that are not public or server specific.

I will add an index.ts file to common inside search profiler marking these values similarly as internal 👍

@@ -19,8 +19,22 @@ interface ReturnValue {
error?: string;
}

const extractProfilerErrorMessage = async (e: any): Promise<string | undefined> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it need to be async?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Initially I was doing something async in there but then simplified and forgot to update the async bit 👍

*/

import { IRouter, Logger } from 'kibana/server';
import { ElasticsearchPlugin } from 'src/legacy/core_plugins/elasticsearch';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it OK to import from the src alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update!

@jloleysens
Copy link
Contributor Author

@sebelga

I was testing in a situation where the license changes while the user is interacting with the UI, will clarify, thanks for testing that scenario!

Marked types and values as internal
Removed unnecessary "async" from function
Update import to not use "src" alias
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@jloleysens jloleysens merged commit b8d3510 into elastic:master Jan 22, 2020
@jloleysens jloleysens deleted the np/searchprofiler/move-out-of-legacy branch January 22, 2020 12:58
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jan 22, 2020
* Initial move of searchprofiler into new platform directory, lots of things need testing

* Whitespace, clean up types and remove unused files

* First iteration of end-to-end plugin working

- Updated license check to only check for presence of basic license (not search profiler as a feature
- Updated the payload: removed types from validation
- Also added README in public regarding the location of styles

* Added extractProfilerErrorMessage function to interface with new error reporting from profiler endpoint

* Fix paths to test_utils

* Update I18n for search profiler

* Fix react hooks ordering bug with license status updates and fix test (wait for first license object before rendering)

* Added index.ts file to common in searchprofiler route
Marked types and values as internal
Removed unnecessary "async" from function
Update import to not use "src" alias

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jan 22, 2020
…t-of-legacy

* 'master' of github.com:elastic/kibana:
  [Watcher] Add support for additional watch action statuses (elastic#55092)
  [ML] Fix entity controls update. (elastic#55524)
  [ML] Fixing ML's watcher integration (elastic#55439)
  [ML] Fixes permissions checks for data visualizer create job links (elastic#55431)
  [SearchProfiler] Move out of legacy (elastic#55331)

# Conflicts:
#	x-pack/plugins/watcher/server/models/action_status/action_status.js
jloleysens added a commit that referenced this pull request Jan 22, 2020
* Initial move of searchprofiler into new platform directory, lots of things need testing

* Whitespace, clean up types and remove unused files

* First iteration of end-to-end plugin working

- Updated license check to only check for presence of basic license (not search profiler as a feature
- Updated the payload: removed types from validation
- Also added README in public regarding the location of styles

* Added extractProfilerErrorMessage function to interface with new error reporting from profiler endpoint

* Fix paths to test_utils

* Update I18n for search profiler

* Fix react hooks ordering bug with license status updates and fix test (wait for first license object before rendering)

* Added index.ts file to common in searchprofiler route
Marked types and values as internal
Removed unnecessary "async" from function
Update import to not use "src" alias

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@cjcenizal cjcenizal added this to Done in Elasticsearch UI Mar 2, 2020
@cjcenizal cjcenizal moved this from Done to Done - NP migration in Elasticsearch UI Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dev Tools Feature:NP Migration Feature:Search Profiler Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v8.0.0
Projects
Elasticsearch UI
  
Done - NP migration
Development

Successfully merging this pull request may close these issues.

None yet

5 participants