Skip to content

Conversation

@jasonrhodes
Copy link
Member

@jasonrhodes jasonrhodes commented Apr 29, 2020

Closes #57999
Closes #61773

Summary

This PR moves our logs/metrics saved object registration to the new platform and removes the legacy infra plugin as it's no longer needed 🎉 🎉 🎉 .

In doing this, I've also made all 3 of our saved objects importable and exportable.

To test this:

  • visit the logs or metrics section to verify that you can modify the settings in each
  • visit the metrics explorer and save a view
  • visit the metrics inventory and save a view
  • navigate to the management section and look in the saved objects list, you should see 3 saved objects saved there that are now all exportable

Outstanding questions

These have been asked in Slack in #kibana-platform, but still need to be addressed:

  • The migration guide here: https://github.com/elastic/kibana/blob/master/src/core/MIGRATION_EXAMPLES.md#saved-objects-types
    says there is a value called namespaceAgnostic that used to be isNamespaceAgnostic, but the SavedObjectType TS type I'm using says the field is namespaceType and that it's required. And I don't know what it is or does (I also don't know what hidden is or does, which is another required field, but I guessed on that one)
  • I'd also like to understand what all of the "management" and "migration" field options do ... what's the best way to discover these things?
  • also, it looks like the SavedObjectsType from src/core/server isn't a generic, so is it not possible to type the mappings?

@jasonrhodes jasonrhodes requested a review from a team as a code owner April 29, 2020 22:44
@jasonrhodes jasonrhodes added v7.8.0 release_note:skip Skip the PR/issue when compiling release notes labels Apr 29, 2020
@weltenwort
Copy link
Member

The migration guide here: /src/core/MIGRATION_EXAMPLES.md@master#saved-objects-types
says there is a value called namespaceAgnostic that used to be isNamespaceAgnostic, but the SavedObjectType TS type I'm using says the field is namespaceType and that it's required. And I don't know what it is or does (I also don't know what hidden is or does, which is another required field, but I guessed on that one)

https://github.com/elastic/kibana/blob/dcc4081bd81d080776f019e98232fe743bd226d2/docs/development/core/server/kibana-plugin-core-server.savedobjectstype.md might be able to explain the attributes.

it looks like the SavedObjectsType from src/core/server isn't a generic, so is it not possible to type the mappings?

The type of the value returned from a savedObjectClient is

export interface SavedObject<T = unknown> {
/** The ID of this Saved Object, guaranteed to be unique for all objects of the same `type` */
id: string;
/** The type of Saved Object. Each plugin can define it's own custom Saved Object types. */
type: string;
/** An opaque version number which changes on each successful write operation. Can be used for implementing optimistic concurrency control. */
version?: string;
/** Timestamp of the last time this document had been updated. */
updated_at?: string;
error?: {
message: string;
statusCode: number;
};
/** {@inheritdoc SavedObjectAttributes} */
attributes: T;
/** {@inheritdoc SavedObjectReference} */
references: SavedObjectReference[];
/** {@inheritdoc SavedObjectsMigrationVersion} */
migrationVersion?: SavedObjectsMigrationVersion;
/** Namespace(s) that this saved object exists in. This attribute is only used for multi-namespace saved object types. */
namespaces?: string[];
}
, which is generic in its attributes.

The SavedObjectType is the declaration used to register a type.

In any case, I would recommend using io-ts to decode anything retrieved from ES via a savedObjectClient as we do for the source configuration. That way it is properly and consistently typed regardless.

@jasonrhodes jasonrhodes added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:skip Skip the PR/issue when compiling release notes labels Apr 30, 2020
@jasonrhodes jasonrhodes self-assigned this Apr 30, 2020
@afgomez afgomez self-requested a review May 4, 2020 12:02
Copy link
Contributor

@afgomez afgomez left a comment

Choose a reason for hiding this comment

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

I pulled the code. I couldn't find anything broken 🎉

@afgomez
Copy link
Contributor

afgomez commented May 4, 2020

@weltenwort I'm so sorry. I just saw that you were reviewing this PR already. For some reason github didn't put your avatar in the reviewers' list and I assigned it to myself.

@jasonrhodes
Copy link
Member Author

@afgomez I think @weltenwort just commented on something, I don't think he assigned himself as a reviewer. Thanks to you both! I'm going to see about adding a decode before I merge anything.

@jasonrhodes jasonrhodes added the release_note:skip Skip the PR/issue when compiling release notes label May 4, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@jasonrhodes jasonrhodes merged commit 9be4ec0 into elastic:master May 5, 2020
@jasonrhodes jasonrhodes deleted the 57999-remove-legacy-infra-plugin branch May 5, 2020 15:05
gmmorris added a commit to gmmorris/kibana that referenced this pull request May 5, 2020
* master: (133 commits)
  Cleanup Typescript index pattern field editor / Expression functions for bucket agg (elastic#65254)
  Removes legacy infra plugin and moves saved objects registration to NP (elastic#64848)
  Added support for docLinks plugin in Connectors forms and missing save capabilities for modal dialog (elastic#64986)
  [SIEM] Removes prebuilt rules number dependency (elastic#65128)
  [Maps] add categorical palettes with 20 and 30 categories (elastic#64701)
  [CI] Slack alerts - Elasticsearch snapshot failures (elastic#64724)
  [Uptime] Console errors in case index missing (elastic#65115)
  [SIEM][CASE] Dynamic fields mapping based on connector (elastic#64412)
  [test/functional] Tsfy page objects (elastic#64887)
  [Maps] [Telemetry] Track geo_point and geo_shape index patterns separately (elastic#65195)
  [Maps] Add global fit to data (elastic#64702)
  Visualize: Reload on ui state change and fix ui state for tsvb (elastic#63699)
  [SIEM] [Cases] External service selection per case (elastic#64775)
  [Uptime] Set ML anomaly look-back to 2w (from 24h) / Add spinner (elastic#65055)
  [Metrics UI] Remove APM Hard Dependency (elastic#64952)
  [Ingest] Datastream list: add icons and dashboard links (elastic#65048)
  disable plugins. they could access ES via SO repository (elastic#65242)
  Feature fleet enrollment instructions (elastic#65176)
  [SIEM] Adds 'Configure connector' Cypress test (elastic#64807)
  [TSVB] Fix std deviation band mode (elastic#64413)
  ...
jasonrhodes added a commit to jasonrhodes/kibana that referenced this pull request May 6, 2020
elastic#64848)

* Removes legacy infra plugin and moves saved objects to NP

* Removes unnecessary legacy getLibs method

* Reverts saved objects to "single" namespace mode
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 v7.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Logs + Metrics UI] Make source configurations exportable and importable [Logs / Metrics UI] [NP followup] Remove the legacy plugin

4 participants