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

[Reporting] Use a shim for server config #62086

Merged
merged 20 commits into from
Apr 4, 2020

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Mar 31, 2020

Summary

This PR is to break out some changes from #61696. It retains the changes that update the call signatures of the code, but this PR does not actually change the source of config: the config data still comes from server.config().get() -- not the New Platform yet.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@tsullivan tsullivan changed the title [Reporting] Add a shim for server config [Reporting] Use a shim for server config Mar 31, 2020
@tsullivan tsullivan force-pushed the reporting/server-config-shim branch 2 times, most recently from 46b12fd to 58c12cb Compare April 1, 2020 21:45
@tsullivan tsullivan force-pushed the reporting/server-config-shim branch from 832cb9b to 79b1481 Compare April 2, 2020 04:54
@tsullivan tsullivan force-pushed the reporting/server-config-shim branch from 79b1481 to 1705882 Compare April 2, 2020 18:38
@@ -51,15 +51,8 @@ export function registerGenerateCsvFromSavedObjectImmediate(
const request = makeRequestFacade(legacyRequest);
const logger = parentLogger.clone(['savedobject-csv']);
const jobParams = getJobParamsFromRequest(request, { isImmediate: true });

/* TODO these functions should be made available in the export types registry:
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 think if we make the "execute job function factory" functions return immediately instead of returning a promise, I'd be satisfied this TODO is no longer needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

BTW a few more of these TODOs have been removed, above

JobParamsType,
unknown,
unknown,
ImmediateExecuteFn<JobParamsType> | ESQueueWorkerExecuteFn<JobDocPayloadType>
Copy link
Member Author

Choose a reason for hiding this comment

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

replacing the any here helps provide the correct typing for jobExecutor

parentLogger: Logger
) {
const browserDriverFactory = await reporting.getBrowserDriverFactory();
Copy link
Member Author

Choose a reason for hiding this comment

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

This PR starts moving async things in execute job factory function to be resolved in the function that is returned instead of before, so the factory function can return immediately instead of returning a promise. Having reporting.getConfig() return synchronously (instead of async) kind of helps get that idea working.

@tsullivan tsullivan marked this pull request as ready for review April 2, 2020 22:08
@tsullivan tsullivan requested review from joelgriffith and a team April 2, 2020 22:08
@tsullivan tsullivan added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes v7.8.0 labels Apr 2, 2020
@@ -16,7 +16,7 @@ import { ReportingConfig, ReportingConfigType } from './core';
export interface ReportingSetupDeps {
elasticsearch: ElasticsearchServiceSetup;
security: SecurityPluginSetup;
usageCollection: UsageCollectionSetup;
usageCollection?: UsageCollectionSetup;
Copy link
Member Author

Choose a reason for hiding this comment

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

cc @ @afharo - this commit is from your feedback on #61696

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@joelgriffith joelgriffith left a comment

Choose a reason for hiding this comment

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

whew, LGTM, the difference in additions/subtractions

@tsullivan tsullivan merged commit f1f93d3 into elastic:master Apr 4, 2020
tsullivan added a commit to tsullivan/kibana that referenced this pull request Apr 4, 2020
* config shim

* simplify route register calls

* switch to in-sync worker functions

* fix tests

* comment

* fix set up config with defaults

* reduce loc change

* remove test for removed file

* reportingconfigtype

* revert changing executeJobFactory to synchronous

* imports cleanup

* Clean up some awaits

* undo comment

* clean up async

* clean up imports

* add warning logs for config defaults

* Move around some config shim code

* Register routes params take ReportingCore

* usageCollection is an optional dependency
@tsullivan tsullivan deleted the reporting/server-config-shim branch April 4, 2020 04:54
gmmorris added a commit to gmmorris/kibana that referenced this pull request Apr 6, 2020
…into event-log/query-support

* 'event-log/query-support' of github.com:gmmorris/kibana: (41 commits)
  [jenkins] refer to sizes in most pipeline code (elastic#62082)
  skip flaky suite (elastic#60470)
  [Discover] Fix flaky FT in field visualize (elastic#62418)
  [ML] Data Frame Analytics: Fix feature importance (elastic#61761)
  [Reporting] Use a shim for server config (elastic#62086)
  [Reporting] Fix reporting for non-default spaces (elastic#62226)
  Fix bug that coerced empty scaled float value to 0 (elastic#62251)
  [SIEM] [Detection Engine] Remove has manage api keys requireme… (elastic#62446)
  [Maps] Safely handle empty string and invalid strings from EuiColorPicker (elastic#62507)
  Reporting/bug more blacklisted headers (elastic#62389)
  [SIEM] Prevent undefined behavior in our ML popover (elastic#62498)
  [SIEM] [Detection Engine] remove all unknowns from all rules t… (elastic#62327)
  base changes for active/current node styling (elastic#62007)
  [kbn/ui-shared-deps] expand and split (elastic#62364)
  [ML] DF Analytics - ensure destination index pattern created (elastic#62450)
  Mark rule run as failure if there was an error (elastic#62383)
  Add docs for metric explorer alerts (elastic#62314)
  skip flaky suite (elastic#62281)
  [SIEM][Detection Engine] Fixes export of single rule and the icons
  fixes flakiness (elastic#62406)
  ...
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 7, 2020
tsullivan added a commit that referenced this pull request Apr 8, 2020
* [Reporting] Use a shim for server config (#62086)

* config shim

* simplify route register calls

* switch to in-sync worker functions

* fix tests

* comment

* fix set up config with defaults

* reduce loc change

* remove test for removed file

* reportingconfigtype

* revert changing executeJobFactory to synchronous

* imports cleanup

* Clean up some awaits

* undo comment

* clean up async

* clean up imports

* add warning logs for config defaults

* Move around some config shim code

* Register routes params take ReportingCore

* usageCollection is an optional dependency

* get config from ReportingCore for legacy (7.x) routes

* fix parse errors

* fix 7.x deltas

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants