-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] New Platform server shim: update usage collector to use core savedObjects #58058
Conversation
Pinging @elastic/ml-ui (:ml) |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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:
coreSavedObjects: SavedObjectsServiceStart; | |
savedObjects: SavedObjectsServiceStart; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
7f80996
to
86b5084
Compare
1857467
to
9464b57
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…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
…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
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.