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

[ML] New Platform server shim: update usage collector to use core savedObjects #58058

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Feb 19, 2020

Summary

Related meta issue: #49743

Update usageCollector to use NP savedObjects and remove legacy deps.

Checklist

Delete any items that are not applicable to this PR.

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM, but added a question about saved objects and a related upcoming PR.

)) as MlTelemetrySavedObject;
const mlTelemetrySavedObject = ((await savedObjects
.createInternalRepository()
.get('ml-telemetry', ML_TELEMETRY_DOC_ID)) as unknown) as MlTelemetrySavedObject;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why the as unknown is now necessary? I wonder if this upcoming PR related to saved objects might allow us to do this in a better way? Is it worth waiting until it is in maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

You should already be able to specify a generic for .get(), #58022, just makes it required. So .get<MlTelemetrySavedObject>('ml-telemetry', ML_TELEMETRY_DOC_ID) should work out of the box.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated type in 486fc3b5cc351c937f217ab85fc9adc9fadf91a4

@@ -69,6 +67,7 @@ export interface MlCoreSetup {
injectUiAppVars: (id: string, callback: () => {}) => any;
http: MlHttpServiceSetup;
savedObjects: SavedObjectsLegacyService;
coreSavedObjects: SavedObjectsServiceStart;
Copy link
Contributor

Choose a reason for hiding this comment

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

You might save yourself some time by naming this the same as it is on CoreStart:

Suggested change
coreSavedObjects: SavedObjectsServiceStart;
savedObjects: SavedObjectsServiceStart;

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that you're using that name already for the legacy interface. I recommend switching that to a separate "legacy" object that gets passed into start, similar to the second code example in this section (look for LegacySetup): https://github.com/elastic/kibana/blob/master/src/core/MIGRATION.md#introduce-new-plugin-definition-shim

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @joshdover. 😄 I think at this point, we're close enough to just cut over fully to NP so instead of making this change now I'll go ahead and switch over to NP in a follow-up PR

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

  • 💚 Build #28265 succeeded 1857467aea8d80fefaf2ac5da297b5cbd2b4ea3a
  • 💔 Build #28243 failed 12bb3a869e882e8fb0162f1874601b2f3e9ee383
  • 💔 Build #28210 failed 68cc341302cfee56e70a182e5478293234223423
  • 💚 Build #28165 succeeded 486fc3b5cc351c937f217ab85fc9adc9fadf91a4
  • 💚 Build #28007 succeeded 7f809968171111270c7adcac15f62a2b009a7aa2

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

alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request Feb 24, 2020
…edObjects (elastic#58058)

*  use NP savedObjects and createInternalRepository for usage collection

* fix route doc typo

* update MlTelemetrySavedObject type

* remove fileDataVisualizer routes dependency on legacy es plugin

* update mlTelemetry tests

* remove deprecated use of getSavedObjectsClient
@alvarezmelissa87 alvarezmelissa87 deleted the ml-np-usage-collector branch February 24, 2020 16:19
alvarezmelissa87 added a commit that referenced this pull request Feb 24, 2020
…edObjects (#58058) (#58367)

*  use NP savedObjects and createInternalRepository for usage collection

* fix route doc typo

* update MlTelemetrySavedObject type

* remove fileDataVisualizer routes dependency on legacy es plugin

* update mlTelemetry tests

* remove deprecated use of getSavedObjectsClient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration :ml release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants