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

Explicitly set level for all registered deprecations #115344

Closed
31 of 32 tasks
pgayvallet opened this issue Oct 18, 2021 · 6 comments
Closed
31 of 32 tasks

Explicitly set level for all registered deprecations #115344

pgayvallet opened this issue Oct 18, 2021 · 6 comments
Labels
deprecation_warnings impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Meta Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Security Solution Platform Security Solution Platform Team

Comments

@pgayvallet
Copy link
Contributor

pgayvallet commented Oct 18, 2021

Required for #114197

In #114197, we're planning to no longer have the deprecation's level be optional when registering it.

For this reason, we need all deprecation owners to explicitly set the correct level for all of their existing deprecations, both config deprecations registered via the PluginConfigDescriptor, and deprecations registered via the core.deprecations API.

This will also be an occasion for all deprecation owners to check if their deprecations are defining their correct level, as most deprecations are currently using the default, which is critical, and may be wrong.

Note: having a deprecation with an incorrect level is considered a bug. Therefor, fixing your deprecation's level can be flagged as bug and merged after 7.16 FF.

How to choose the correct deprecation level?

Please follow these guidelines to decide if your deprecation should be considered as critical or warning:

  • Critical deprecations are ones that must be addressed before the upgrade, otherwise the deployment will be unstable, degraded, fail to start, or otherwise exhibit undesirable and unintended behavior.
  • Warning deprecations are everything else. They're optional or they may not apply to the user. The user has discretion to decide whether or not to act on them. If the user ignores them and upgrades the deployment, the deployment will function normally.

How to adapt my deprecation to set the correct level?

For config deprecations (registered with the plugin's config)

factory deprecations

Add the level option to the (optional) last parameter of the deprecation factory.

before

export const config: PluginConfigDescriptor<ConfigType> = {
  schema: configSchema,
  deprecations: ({ deprecate, rename, unused }) => [
    deprecate('enabled', '8.0.0'),
    rename('old', 'new'),
    unused('unused'),
  ],
};

after

export const config: PluginConfigDescriptor<ConfigType> = {
  schema: configSchema,
  deprecations: ({ deprecate, rename, unused }) => [
    deprecate('enabled', '8.0.0', { level: 'critical'}),
    rename('old', 'new', { level: 'warning'}),
    unused('unused', { level: 'warning'}),
  ],
};

non-factory deprecations

Just add the level option to the addDeprecation call:

before

export const config: PluginConfigDescriptor<MyConfigType> = {
  schema: ConfigSchema,
  deprecations: () => [
    (settings, fromPath, addDeprecation) => {
      if (someCondition) {
        addDeprecation({
          configPath: 'plugin.somePath',
          title: 'some title',
          message: `some message`,
          correctiveActions: {
            manualSteps: [`come on, do something`],
          },
        });
      }
    },
  ],
};

after

export const config: PluginConfigDescriptor<MyConfigType> = {
  schema: ConfigSchema,
  deprecations: () => [
    (settings, fromPath, addDeprecation) => {
      if (someCondition) {
        addDeprecation({
          configPath: 'plugin.somePath',
          level: ''warning, // <-- that's the only change
          title: 'some title',
          message: `some message`,
          correctiveActions: {
            manualSteps: [`come on, do something`],
          },
        });
      }
    },
  ],
};

For other deprecations (registered via core.deprecations)

Just specify the level option when returning your deprecations

before

core.deprecations.registerDeprecations({
   getDeprecations: async (context) => {
     return [{
       title: 'some title',
       message: 'some message',
       deprecationType: 'feature',
       correctiveActions: { /* */ }
     }];
   }
}) 

after

core.deprecations.registerDeprecations({
   getDeprecations: async (context) => {
     return [{
       level: 'critical', // <-- this is the only change
       title: 'some title',
       message: 'some message',
       deprecationType: 'feature',
       correctiveActions: { /* */ }
     }];
   }
}) 

Inventory

Note: this is the inventory from the 7.x branch, as a lot of deprecations are only present on this branch and not on master, and I don't think we have a lot of deprecations on master that are not present in 7.x. However, that's each team's responsibility to properly also reverse-backport/apply their changes on master when necessary.

I did not include the deprecate('enabled', '8.0.0') config deprecations in the per-team list to avoid pinging unnecessary teams, as we know those are all critical.

@elastic/kibana-core

done in #115501

  • /src/plugins/home/server/index.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('kibana.disableWelcomeScreen', 'home.disableWelcomeScreen'),
],

  • /src/plugins/newsfeed/server/index.ts

deprecations: ({ unused }) => [unused('defaultLanguage')],

  • /src/plugins/telemetry/server/config/config.ts

deprecations: () => [deprecateEndpointConfigs],

  • /src/plugins/usage_collection/server/config.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('ui_metric.enabled', 'usageCollection.uiCounters.enabled'),
renameFromRoot('ui_metric.debug', 'usageCollection.uiCounters.debug'),
renameFromRoot('usageCollection.uiMetric.enabled', 'usageCollection.uiCounters.enabled'),
renameFromRoot('usageCollection.uiMetric.debug', 'usageCollection.uiCounters.debug'),
],

  • /x-pack/plugins/banners/server/config.ts

deprecations: () => [
(rootConfig, fromPath, addDeprecation) => {
const pluginConfig = get(rootConfig, fromPath);
if (pluginConfig?.placement === 'header') {
addDeprecation({

  • /x-pack/plugins/licensing/server/licensing_config.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot(
'xpack.xpack_main.xpack_api_polling_frequency_millis',
'xpack.licensing.api_polling_frequency'
),

@elastic/kibana-stack-management

  • /src/plugins/console/server/config.ts (183a1c3)

deprecations: ({ deprecate, unused }) => [
deprecate('enabled', '8.0.0'),
deprecate('proxyFilter', '8.0.0'),
deprecate('proxyConfig', '8.0.0'),
unused('ssl'),
],

@elastic/kibana-app-services

  • /src/plugins/data/server/index.ts

export const config: PluginConfigDescriptor<ConfigSchema> = {
deprecations: autocompleteConfigDeprecationProvider,

deprecations: ({ unused }) => [
unused('capture.browser.chromium.maxScreenshotDimension'), // unused since 7.8
unused('poll.jobCompletionNotifier.intervalErrorMultiplier'), // unused since 7.10
unused('poll.jobsRefresh.intervalErrorMultiplier'), // unused since 7.10
unused('capture.viewport'), // deprecated as unused since 7.16

@elastic/kibana-vis-editors

  • /src/plugins/kibana_legacy/server/index.ts

deprecations: ({ renameFromRoot }) => [
// TODO: Remove deprecation once defaultAppId is deleted
renameFromRoot('kibana.defaultAppId', 'kibana_legacy.defaultAppId', { silent: true }),

  • /src/plugins/vis_types/metric/server/index.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('metric_vis.enabled', 'vis_type_metric.enabled'),
],

  • /src/plugins/vis_types/table/server/index.ts

deprecations: ({ renameFromRoot, unused }) => [
renameFromRoot('table_vis.enabled', 'vis_type_table.enabled'),
// Unused property which should be removed after releasing Kibana v8.0:
unused('legacyVisEnabled'),
],

  • /src/plugins/vis_types/tagcloud/server/index.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('tagcloud.enabled', 'vis_type_tagcloud.enabled'),
],

  • /src/plugins/vis_types/timelion/server/index.ts

deprecations: ({ renameFromRoot, unused }) => [
renameFromRoot('timelion_vis.enabled', 'vis_type_timelion.enabled'),
renameFromRoot('timelion.enabled', 'vis_type_timelion.enabled'),
renameFromRoot('timelion.graphiteUrls', 'vis_type_timelion.graphiteUrls'),

  • /src/plugins/vis_types/timeseries/server/index.ts

deprecations: ({ unused, renameFromRoot }) => [
// In Kibana v7.8 plugin id was renamed from 'metrics' to 'vis_type_timeseries':
renameFromRoot('metrics.enabled', 'vis_type_timeseries.enabled'),
renameFromRoot('metrics.chartResolution', 'vis_type_timeseries.chartResolution', {
silent: true,

  • /src/plugins/vis_types/vega/server/index.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('vega.enableExternalUrls', 'vis_type_vega.enableExternalUrls'),
renameFromRoot('vega.enabled', 'vis_type_vega.enabled'),

@elastic/kibana-presentation

deprecations: ({ renameFromRoot }) => [
renameFromRoot('markdown_vis.enabled', 'vis_type_markdown.enabled'),
],

@elastic/kibana-alerting-services

Done #115832

  • /x-pack/plugins/actions/server/index.ts

deprecations: ({ renameFromRoot, unused }) => [
renameFromRoot('xpack.actions.whitelistedHosts', 'xpack.actions.allowedHosts'),
(settings, fromPath, addDeprecation) => {

  • /x-pack/plugins/alerting/server/index.ts

deprecations: ({ renameFromRoot }) => [
renameFromRoot('xpack.alerts.healthCheck', 'xpack.alerting.healthCheck'),
renameFromRoot(
'xpack.alerts.invalidateApiKeysTask.interval',
'xpack.alerting.invalidateApiKeysTask.interval'
),

  • /x-pack/plugins/event_log/server/index.ts

deprecations: () => [
(settings, fromPath, addDeprecation) => {
if (
settings?.xpack?.eventLog?.enabled === false ||
settings?.xpack?.eventLog?.enabled === true
) {

  • /x-pack/plugins/stack_alerts/server/index.ts

deprecations: () => [
(settings, fromPath, addDeprecation) => {
const stackAlerts = get(settings, fromPath);
if (stackAlerts?.enabled === false || stackAlerts?.enabled === true) {

  • /x-pack/plugins/task_manager/server/index.ts

deprecations: () => [
(settings, fromPath, addDeprecation) => {
const taskManager = get(settings, fromPath);
if (taskManager?.index) {

  • /x-pack/plugins/triggers_actions_ui/server/index.ts

deprecations: () => [
(settings, fromPath, addDeprecation) => {
const triggersActionsUi = get(settings, fromPath);

@elastic/apm-ui

Done in #116272

  • /x-pack/plugins/apm/server/index.ts

}) => [
deprecate('enabled', '8.0.0'),
renameFromRoot(
'apm_oss.transactionIndices',
'xpack.apm.indices.transaction'
),

It already has a level

  • /x-pack/plugins/apm/server/deprecations/index.ts

return async ({
savedObjectsClient,
}: GetDeprecationsContext): Promise<DeprecationsDetails[]> => {
const deprecations: DeprecationsDetails[] = [];
if (!fleet) {
return deprecations;
}

@elastic/security-threat-hunting (#118268)

  • /x-pack/plugins/cases/server/index.ts

deprecations: ({ deprecate, renameFromRoot }) => [
deprecate('enabled', '8.0.0'),
renameFromRoot('xpack.case.enabled', 'xpack.cases.enabled'),
],

@elastic/kibana-security

export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
rename,
renameFromRoot,
unused,
}) => [
rename('sessionTimeout', 'session.idleTimeout'),
rename('authProviders', 'authc.providers'),

export const spacesConfigDeprecationProvider: ConfigDeprecationProvider = () => {
return [disabledDeprecation];
};

@elastic/fleet

  • /x-pack/plugins/fleet/server/index.ts

deprecations: ({ deprecate, renameFromRoot, unused, unusedFromRoot }) => [
deprecate('enabled', '8.0.0'),
// Fleet plugin was named ingestManager before
renameFromRoot('xpack.ingestManager.enabled', 'xpack.fleet.enabled'),

@elastic/kibana-gis

  • /x-pack/plugins/maps/server/index.ts

deprecations: ({ deprecate }) => [
deprecate('enabled', '8.0.0'),
(
completeConfig: Record<string, any>,
rootPath: string,
addDeprecation: AddConfigDeprecation
) => {

@elastic/security-solution (#118268)

  • /x-pack/plugins/security_solution/server/index.ts

deprecations: ({ deprecate, renameFromRoot }) => [
deprecate('enabled', '8.0.0'),
renameFromRoot('xpack.siem.enabled', 'xpack.securitySolution.enabled'),
renameFromRoot(
'xpack.siem.maxRuleImportExportSize',
'xpack.securitySolution.maxRuleImportExportSize'
),

@elastic/rac

  • /x-pack/plugins/rule_registry/server/config.ts

deprecations: ({ deprecate, unused }) => [
deprecate('enabled', '8.0.0'),
unused('unsafe.indexUpgrade.enabled'),
],

List of deprecate('enabled', '8.0.0') deprecations

Only here for tracking purposes, if we eventually want to specify level: 'critical' on those:

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],
(done via #115395 in 7.x only, no deprecations remaining in master)

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')],

cc @cjcenizal

@stratoula
Copy link
Contributor

@pgayvallet this one /src/plugins/vis_type_markdown/server/index.ts is owned by the @elastic/kibana-presentation team so I think it will be better if they could handle it. All the others are being handled here #115505

@pgayvallet pgayvallet added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Nov 3, 2021
@botelastic botelastic bot removed the needs-team Issues missing a team label label Nov 3, 2021
@pgayvallet
Copy link
Contributor Author

Friendly reminder to @elastic/kibana-app-services @elastic/kibana-presentation @elastic/kibana-alerting-services @elastic/apm-ui @elastic/security-threat-hunting @elastic/fleet @elastic/kibana-gis @elastic/security-solution @elastic/rac that this would ideally be done before 7.16 goes live.

@jasonrhodes
Copy link
Member

@pgayvallet can you confirm if we should or should not add levels to the "enabled" deprecations in any/all plugins?

@pgayvallet
Copy link
Contributor Author

pgayvallet commented Nov 18, 2021

can you confirm if we should or should not add levels to the "enabled" deprecations in any/all plugins?

Sorry for the late answer. No, don't mind the enabled deprecation, you can ignore them (we know those are all critical).

@cjcenizal
Copy link
Contributor

@pgayvallet Can we close this issue now? Looks like everything has been addressed.

@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
@pgayvallet
Copy link
Contributor Author

Yea, this is done, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation_warnings impact:needs-assessment Product and/or Engineering needs to evaluate the impact of the change. loe:small Small Level of Effort Meta Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:Security Solution Platform Security Solution Platform Team
Projects
None yet
Development

No branches or pull requests

5 participants