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

Kibana property config migrations #55937

Merged
merged 16 commits into from
Feb 4, 2020

Conversation

nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Jan 24, 2020

Summary

Related issue #54497

Move global kibana config properties/remove injectedMetadata usage

  • Move kibana.defaultAppId to kibana_legacy plugin
  • Move kibana.disableWelcomeScreen to home.disableWelcomeScreen in `Home plugin.

Core server API changes Updates

ConfigDeprecationFactory#renameFromRoot now allows silent as the third argument to mute depreciation logging.

Checklist

For maintainers

@nickofthyme
Copy link
Contributor Author

@flash1293 I noticed that the configService prevents duplicate schema configs per path.

Since kibana is already defined as a global config here 👇

export const config = {
path: 'kibana',
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
defaultAppId: schema.string({ defaultValue: 'home' }),
index: schema.string({ defaultValue: '.kibana' }),
disableWelcomeScreen: schema.boolean({ defaultValue: false }),
autocompleteTerminateAfter: schema.duration({ defaultValue: 100000 }),
autocompleteTimeout: schema.duration({ defaultValue: 1000 }),
}),
};

I can't define the "configPath": "kibana", in kibana_legacy/kibana.json and there doesn't appear to be a way to alias the name. So should I remove all the kibana.* config and put them in kibana_legacy?

I also wasn't sure how this config below was different than the one above. Seem to like like a duplicate schema.

return new kibana.Plugin({
id: 'kibana',
config: function(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
defaultAppId: Joi.string().default('home'),
index: Joi.string().default('.kibana'),
disableWelcomeScreen: Joi.boolean().default(false),
autocompleteTerminateAfter: Joi.number()
.integer()
.min(1)
.default(100000),
// TODO Also allow units here like in elasticsearch config once this is moved to the new platform
autocompleteTimeout: Joi.number()
.integer()
.min(1)
.default(1000),
}).default();
},

@flash1293
Copy link
Contributor

flash1293 commented Jan 27, 2020

@nickofthyme

I noticed that the configService prevents duplicate schema configs per path.

Very good point, I think you can use a deprecation helper though to rename the config key, right? I think you can't use the default renameRoot one because it will emit a log message which we should avoid in this case, but you can also write your own.

I also wasn't sure how this config below was different than the one above. Seem to like like a duplicate schema.

Good catch, didn't notice that. They should definitely stay in sync (so if you are moving out something to the new platform, remove it from both)

Questionable tasks
Move kibana.autocompleteTerminateAfter to kibana_legacy plugin
Move kibana. autocompleteTimeout to kibana_legacy plugin
Remove all kibana global config properties. (i.e. defaultAppId and index)

Those can be omitted for this PR. There is also some discussion about those going on in #46705

@nickofthyme nickofthyme changed the title Kpm/config change Kibana config migration Jan 27, 2020
@nickofthyme nickofthyme requested review from a team January 30, 2020 21:50
@nickofthyme nickofthyme added Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0 labels Jan 30, 2020
@nickofthyme nickofthyme marked this pull request as ready for review January 30, 2020 23:14
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

LGTM, just left a minor comment.

schema: configSchema,
deprecations: ({ renameFromRoot }) => [
// TODO: Remove deprecation once defaultAppId is deleted
renameFromRoot('kibana.defaultAppId', 'kibana_legacy.defaultAppId'),
Copy link
Contributor

Choose a reason for hiding this comment

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

This triggers a warning in the server logs when kibana.defaultAppId is used:

  log   [16:23:34.047] [warning][config][deprecation] "kibana.defaultAppId" is deprecated and has been replaced by "kibana_legacy.defaultAppId"

Since we are going to sunset the whole config key soon it doesn't really help when users are prompted to change the setting now.

It seems like an easy way to do this is to no pass down the logger function to the helper:

[
    // TODO: Remove deprecation once defaultAppId is deleted
    (config, rootPath) => renameFromRoot('kibana.defaultAppId', 'kibana_legacy.defaultAppId')(config, rootPath, /* don't log this deprecation because it won't stay long*/ () => {}),

Copy link
Contributor

Choose a reason for hiding this comment

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

I was suggesting to copy the renameFromRoot code to ignore the logger, as this was temporary. but the suggestion may be better

@flash1293
Copy link
Contributor

flash1293 commented Jan 31, 2020

@joshdover To give a bit more context on this change - defaultAppId will probably be removed with 8.0 anyway, but this change moves it into the new platform and out of the global injected vars to

  1. Make it explicit who owns this setting
  2. Use regular NP apis to not block migration
  3. In case we decide to keep this alive for backwards compatibility even after removing legacy platform in 7.8

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

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

Platform changes and config deprecations LGTM

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM when the kibana_legacy pluginId is renamed to kibanaLegacy

@@ -1,6 +1,6 @@
{
"id": "kibana_legacy",
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if we did not migrate existing plugin's ids when doing #52190, pluginId should be camelCased. This should be kibanaLegacy

This also means changing calls such as
const { config } = npSetup.plugins.kibana_legacy;
to
const { config } = npSetup.plugins.kibanaLegacy;

Note: this will not change the config path, which default to snakeCase(id) for convention with the stack's naming, so the property access / deprecations don't need any changes

Copy link
Contributor

Choose a reason for hiding this comment

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

We have a separate issue tracking this (#55363) - @maryia-lapata is already working on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, as long as it's tracked, LGTM.

@nickofthyme
Copy link
Contributor Author

@pgayvallet are you ok with changes in e42ac5e like we discussed?

@pgayvallet
Copy link
Contributor

@nickofthyme lgtm

@nickofthyme nickofthyme requested a review from a team as a code owner February 3, 2020 15:59
@nickofthyme nickofthyme merged commit 186a826 into elastic:master Feb 4, 2020
@nickofthyme nickofthyme deleted the kpm/config-change branch February 4, 2020 04:17
@nickofthyme nickofthyme changed the title Kibana config migration Kibana property config migrations Feb 4, 2020
nickofthyme added a commit to nickofthyme/kibana that referenced this pull request Feb 4, 2020
* Move defaultAppId config param into kibanaLegacy
* Move disableWelcomeScreen config param into Home plugin
* Update api and docs with silent option for renameFromRoot
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

nickofthyme added a commit that referenced this pull request Feb 4, 2020
* Move defaultAppId config param into kibanaLegacy
* Move disableWelcomeScreen config param into Home plugin
* Update api and docs with silent option for renameFromRoot
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 4, 2020
* master: (42 commits)
  Move kuery_autocomplete ⇒ NP (elastic#56607)
  [ML] Functional tests - stabilize job row and analytics result view assertions (elastic#56595)
  [Discover] Inline angular directives only used in this plugin (elastic#56119)
  [Discover] Migrate get_sort.js test from mocha to TypeScript (elastic#56011)
  [SIEM] Enable flow_target_select_connected unit tests (elastic#55618)
  Start consuming np logging config (elastic#56480)
  [SIEM] Add eslint-plugin-react-perf (elastic#55960)
  Mention changed SAML ACS endpoint URL in breaking changes doc. (elastic#56613)
  Add `getServerInfo` API to http setup contract (elastic#56636)
  Updates Monitoring alert Jest snapshots
  Kibana property config migrations (elastic#55937)
  Vislib replacement toggle (elastic#56439)
  [Uptime] Add unit tests for QueryContext time calculation (elastic#56671)
  [SIEM][Detection Engine] Critical blocker, fixes pre-packaged rule miscounts
  Upgrade EUI to v18.3.0 (elastic#56228)
  [Maps] Fix server log (elastic#56679)
  [SIEM] Fixes FTUE when APM node is present (elastic#56574)
  [Reporting/FieldFormats] expose `setFieldFormats` and call from ReportingPlugin.start (elastic#56563)
  Update EMS API urls for production (elastic#56657)
  Ability to delete alerts even when AAD is out of sync (elastic#56543)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration 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.

5 participants