Skip to content

Conversation

@justinkambic
Copy link
Contributor

Summary

Working on shimming the Uptime server for the new platform. Code is WIP.

Checklist

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

For maintainers

@justinkambic justinkambic added v8.0.0 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability labels Sep 5, 2019
@justinkambic justinkambic self-assigned this Sep 5, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic justinkambic force-pushed the uptime_server-new-platform branch from ae54462 to 7ad44f3 Compare September 9, 2019 18:36
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic justinkambic requested a review from rudolf September 13, 2019 13:49
Copy link
Contributor

@rudolf rudolf left a comment

Choose a reason for hiding this comment

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

There's a few places where your shim could be using the real NP API's already, but otherwise this is a good start.

elasticsearch,
usageCollector: server.usage,
xpack: xpack_main,
route: (arg: any) => server.route(arg),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not critical as a first step, but at some point it would be good to switch to using the real NP core router inside your shim. You can use server.newPlatform.setup.core.http.createRouter().

initServerWithKibana(server);
const initializerContext = {} as PluginInitializerContext;
const { elasticsearch, xpack_main } = server.plugins;
plugin(initializerContext).setup({
Copy link
Contributor

Choose a reason for hiding this comment

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

The signature for setup is setup(core, plugins) with all plugin dependencies being passed in as the second argument. Usage collector will be exposed from the telemetry plugin and xpack licencing is available as a NP plugin. So it would be a bit more accurate to move these dependencies into a second argument.

init(server: KibanaServer) {
initServerWithKibana(server);
const initializerContext = {} as PluginInitializerContext;
const { elasticsearch, xpack_main } = server.plugins;
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: you can also use the NP elasticsearch client by taking it from server.newPlatform.setup.core.elasticsearch

}
},
plugin: uptimeGraphQLHapiPlugin,
method: ['get', 'post'],
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a useful example for other teams for how to replace the hapi plugin. When you switch to using the NP router in your shim (from server.newPlatform.setup.core.http.createRouter()) you won't be able to define one route with two methods (get & post) so this will have to be split into two routes.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic justinkambic added the release_note:skip Skip the PR/issue when compiling release notes label Oct 10, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@rudolf rudolf left a comment

Choose a reason for hiding this comment

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

This is a good first pass at shimming the NP 👍

Next up I would suggest starting to consume the NP API's for elasticsearch and the http router

@justinkambic
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💔 Build Failed

@justinkambic
Copy link
Contributor Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@justinkambic justinkambic merged commit 0cb7035 into elastic:master Oct 22, 2019
justinkambic added a commit to justinkambic/kibana that referenced this pull request Oct 22, 2019
* WIP, trying things.

* Delete call to hapi register function, use route for bootstrapping GQL.

* Add files to use for new platform shim.

* Add server shim.

* Update mock in test file to conform to new shim interface.

* Delete unneeded import and var declaration.

* Fix broken type files.

* Add plugin shim initializer to app bootstrapper.

* Extract plugins to separate param for shim.

* Rename interface and update tests.

* Delete unneeded file.
justinkambic added a commit that referenced this pull request Oct 25, 2019
* WIP, trying things.

* Delete call to hapi register function, use route for bootstrapping GQL.

* Add files to use for new platform shim.

* Add server shim.

* Update mock in test file to conform to new shim interface.

* Delete unneeded import and var declaration.

* Fix broken type files.

* Add plugin shim initializer to app bootstrapper.

* Extract plugins to separate param for shim.

* Rename interface and update tests.

* Delete unneeded file.
@justinkambic
Copy link
Contributor Author

Backported to:
7.x/7.6.0 426af51
#48934

@justinkambic justinkambic deleted the uptime_server-new-platform branch October 25, 2019 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.6.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants