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

Add warning log for 3rd party legacy plugins #56558

Closed
joshdover opened this issue Jan 31, 2020 · 7 comments · Fixed by #62401
Closed

Add warning log for 3rd party legacy plugins #56558

joshdover opened this issue Jan 31, 2020 · 7 comments · Fixed by #62401
Assignees
Labels
Feature:New Platform Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@joshdover
Copy link
Contributor

Regardless of if we remove legacy plugin support in 7.x or 8.0 (#56205) we should start logging warnings for any 3rd party legacy plugins that are found during the legacy discovering process.

This should include a note to documentation about the upcoming breaking change and how to migrate the plugin.

@joshdover joshdover added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform labels Jan 31, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@joshdover
Copy link
Contributor Author

We need to make sure we can reliably identify 3rd party plugins + should probably only do this in development mode since users don't have any recourse to fix legacy plugins.

@pgayvallet
Copy link
Contributor

Legacy plugins are currently discovered using two config properties: plugins.paths and plugins.scanDirs

// find plugin packs in configured paths/dirs
const packageJson$ = config$.pipe(
mergeMap(config =>
Rx.merge(
...config.get('plugins.paths').map(createPackageJsonAtPath$),
...config.get('plugins.scanDirs').map(createPackageJsonsInDirectory$)
)
),
distinct(getDistinctKeyForFindResult),
share()
);

Default values being:

plugins.paths [ '/x-pack' ]
plugins.scanDirs [ '/plugins', '/src/legacy/core_plugins' ]

Also in legacy, xpack is technically only a single 'plugin' registering all the 'real' plugins at once:

kibana/x-pack/index.js

Lines 38 to 46 in 2a8a7d7

module.exports = function(kibana) {
return [
xpackMain(kibana),
graph(kibana),
monitoring(kibana),
reporting(kibana),
spaces(kibana),
security(kibana),
tilemap(kibana),

As there is no metadata-related approach to 'detect' 3rd party plugins, my guess is that our only option is going to be to detect them depending on their actual path ?

The only info we currently have is the folder the plugin's package.json is inside:

function createPack(packageJson) {
let provider = require(packageJson.directoryPath); // eslint-disable-line import/no-dynamic-require
if (provider.__esModule) {
provider = provider.default;
}
if (typeof provider !== 'function') {
throw createInvalidPackError(packageJson.directoryPath, 'must export a function');
}
return new PluginPack({ path: packageJson.directoryPath, pkg: packageJson.contents, provider });
}

Should we assume than anyPluginPack with a path/directoryPath outside of [./x-pack, ./src/legacy/core_plugins] is a 3rd party plugin?

WDYT? Does anyone see any alternative to that detection approach?

@mshustov
Copy link
Contributor

Should we assume than anyPluginPack with a path/directoryPath outside of [./x-pack, ./src/legacy/core_plugins] is a 3rd party plugin?

Sounds reasonable. I have nothing to add.

Default values being:

I thought we scan kibana-extra as well. Don't we?

@pgayvallet
Copy link
Contributor

pgayvallet commented Mar 20, 2020

I thought we scan kibana-extra as well. Don't we?

We do for NP plugins, but it doesn't seem to be the case for legacy plugins. Env.pluginSearchPaths is only used for NP plugins and that's the only reference outside of the optimizer I could find.

this.pluginSearchPaths = [
resolve(this.homeDir, 'src', 'plugins'),
...(options.cliArgs.oss ? [] : [resolve(this.homeDir, 'x-pack', 'plugins')]),
resolve(this.homeDir, 'plugins'),
...(options.cliArgs.runExamples ? [resolve(this.homeDir, 'examples')] : []),
resolve(this.homeDir, '..', 'kibana-extra'),
];

@joshdover could you confirm that?

@pgayvallet
Copy link
Contributor

This should include a note to documentation about the upcoming breaking change and how to migrate the plugin.

Do we have any persistent url to such documentation? Or should we just point to the source MIGRATION.md file?

@mshustov
Copy link
Contributor

mshustov commented Apr 2, 2020

I know about https://github.com/elastic/kibana/blob/master/docs/migration/migrate_8_0.asciidoc link to the all NP migration docs are valuable as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants