[Reporting/New Platform Migration] Use a new config service on server-side#55882
Conversation
33fa8d4 to
2775800
Compare
331e64e to
f4daf24
Compare
x-pack/legacy/plugins/reporting/server/usage/get_reporting_usage.ts
Outdated
Show resolved
Hide resolved
f4daf24 to
0e980a8
Compare
There was a problem hiding this comment.
The UI needs to be updated in-step with this change cc @joelgriffith
0e980a8 to
58196ce
Compare
4636a55 to
9f345ff
Compare
c6d213a to
537e11d
Compare
|
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
794760d to
cf384f6
Compare
9acaa92 to
80e00d9
Compare
|
|
||
| const kbnConfig = { | ||
| path: { | ||
| data: config.get('path.data'), // FIXME: get from the real PluginInitializerContext |
There was a problem hiding this comment.
Does this FIXME apply once we're out of legacy?
There was a problem hiding this comment.
Yes: since we're in legacy, we have to mock out the initializerContext variable. When we're out of legacy, we will get the data path from the a real initializerContext variable instead of passing server
| }, | ||
| }; | ||
|
|
||
| // spreading arguments as an array allows the return type to be known by the compiler |
There was a problem hiding this comment.
Very clever. Do you think (since we're using get) there's an opportunity for injection of any kind?
There was a problem hiding this comment.
The reportingConfig object would have to be polluted somehow. It doesn't look like that could happen in this part of the code though.
| get: sinon.stub().returns(FIVE_HUNDRED_MEGABYTES), | ||
| }), | ||
| }; | ||
| const config = { get: sinon.stub().returns(FIVE_HUNDRED_MEGABYTES) }; |
There was a problem hiding this comment.
WHY ARE YOU YELLING AT ME
| */ | ||
| const createJobFn = createJobFactory(reporting, server, elasticsearch, logger); | ||
| const executeJobFn = await executeJobFactory(reporting, server, elasticsearch, logger); | ||
| const createJobFn = await createJobFactory(reporting, logger); |
There was a problem hiding this comment.
Possible to Promise.all these?
| const exportTypesRegistry = reporting.getExportTypesRegistry(); | ||
| const getRouteConfigDownload = getRouteConfigFactoryDownloadPre(server, plugins, logger); | ||
| const downloadResponseHandler = downloadJobResponseHandlerFactory(server, elasticsearch, exportTypesRegistry); // prettier-ignore | ||
| const getRouteConfigDownload = getRouteConfigFactoryDownloadPre(config, plugins, logger); |
There was a problem hiding this comment.
Nice work with the API pattern (config, plugins, logger etc)
joelgriffith
left a comment
There was a problem hiding this comment.
Just a few thoughts on passing ReportingConfig around vs properties the modules themselves care about. Might make testing easier and less terse to setup?
joelgriffith
left a comment
There was a problem hiding this comment.
LGTM! Going to test this today and see how it all plays out.
|
@elasticmachine merge upstream |
|
Smoke tests looking good. Will merge once CI is green |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: (34 commits) [APM] add service map config options to legacy plugin (elastic#61002) [App Arch] migrate legacy CSS to new platform (core_plugins/kibana_react) (elastic#59882) Migrated styles for "share" plugin to new platform (elastic#59981) [ML] Module setup with dynamic model memory estimation (elastic#60656) Drilldowns (elastic#59632) Upgrade mocha dev-dependency from 6.2.2 to 7.1.1 (elastic#60779) [SIEM] Overview: Recent cases widget (elastic#60993) [ML] Functional tests - stabilize df analytics clone tests (elastic#60497) [SIEM] Updates process and TLS tables to use ECS 1.5 fields (elastic#60854) Migrate doc view part of discover (elastic#58094) Revert "[APM] Collect telemetry about data/API performance (elastic#51612)" fix(NA): log rotation watchers usage (elastic#60956) [SIEM] [CASES] Build lego blocks case details view (elastic#60864) Create Painless Lab app (elastic#57538) [SIEM] Move Timeline Template field to first step of rule creation (elastic#60840) [Reporting/New Platform Migration] Use a new config service on server-side (elastic#55882) [Alerting] allow email action to not require auth (elastic#60839) [Maps] Default ES document layer scaling type to clusters and show scaling UI in the create wizard (elastic#60668) [APM] Collect telemetry about data/API performance (elastic#51612) Implement Kibana Login Selector (elastic#53010) ...
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
…ervice on server-side (elastic#55882)" (elastic#61075)" This reverts commit 427848c.
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
2 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Reverted: #61075 |
Part of #53898
This PR integrates the
ReportingConfigservice. based on a New-Platform schema, throughout server-side Reporting. This removes the biggest legacy dependency in Reporting.Getting access to the config requires access to the
ReportingCoreobject on the server.The
getConfigfunction returns an object with agetmethod, and akbnConfigobject property that also has a get method. I'm usingconfig.get()to read the Reporting config, andconfig.kbnConfig.get()to read the global Kibana config. ThekbnConfigpart is to keep the call signatures about the same as the legacy code, when reading the global config. For example, to get the server host name, the legacy call isserver.config().get('server.host')and now it's:config.kbnConfig.get('server', 'host'). And it is also type-safe unlike the legacy calls.Because the access is asynchronous, the code tries to strip the config out of the reportingCore object when passing down to other modules, such as routes registration. This is to avoid the need to convert those modules to asynchronous.
As part of the new accessor on the
ReportingCoreobject, this PR also adds an accessor for the Elasticsearch service:Summary of the changes:
ReportingConfigobjectcreateJobFactory/executeJobFactoryfunctions to be asyncReportingCoreobject, don't pass theElasticsearchServiceSetupAPI: useawait reporting.getElasticsearchService()instead.createConfig$to update defaults as needed, becauseconfig.setis not available anymore.Todo
[ ] Accessthis is a TODO for after moving the code to NPpath.datafrom New Platform APIfunction createConfig$config.get()andconfig.kbnConfig.get()type-safe 🎉disableSandboxcode changes: https://github.com/elastic/kibana/pull/55882/files#r395927154Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
[ ] This includes a feature addition or change that requires a release note and was labeled appropriately