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 more detailed unmet deps logging #70098

Merged
merged 6 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/kibana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@
# Specifies locale to be used for all localizable strings, dates and number formats.
# Supported languages are the following: English - en , by default , Chinese - zh-CN .
#i18n.locale: "en"

# xpack.lists.enabled: true
# xpack.ingestManager.enabled: true
joshdover marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 18 additions & 1 deletion src/core/server/plugins/plugins_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,11 @@ export class PluginsService implements CoreService<PluginsServiceSetup, PluginsS
if (this.shouldEnablePlugin(pluginName, pluginEnableStatuses)) {
this.pluginsSystem.addPlugin(plugin);
} else if (isEnabled) {
const unmetPlugins = this.getUnmetPluginDependencies(pluginName, pluginEnableStatuses);
this.log.info(
`Plugin "${pluginName}" has been disabled since some of its direct or transitive dependencies are missing or disabled.`
`Plugin "${pluginName}" has been disabled since some of its direct or transitive dependencies are missing or disabled. Unmet dependencies: [${unmetPlugins.join(
','
)}]`
);
} else {
this.log.info(`Plugin "${pluginName}" is disabled.`);
Expand All @@ -253,6 +256,20 @@ export class PluginsService implements CoreService<PluginsServiceSetup, PluginsS
this.log.debug(`Discovered ${pluginEnableStatuses.size} plugins.`);
}

private getUnmetPluginDependencies(
pluginName: PluginName,
pluginEnableStatuses: Map<PluginName, { plugin: PluginWrapper; isEnabled: boolean }>,
parents: PluginName[] = []
): string[] {
const requiredPlugins = pluginEnableStatuses.get(pluginName)?.plugin.requiredPlugins ?? [];
return requiredPlugins
.filter((dep) => !parents.includes(dep))
.filter(
(dependencyName) =>
!this.shouldEnablePlugin(dependencyName, pluginEnableStatuses, [...parents, pluginName])
);
}
joshdover marked this conversation as resolved.
Show resolved Hide resolved

private shouldEnablePlugin(
pluginName: PluginName,
pluginEnableStatuses: Map<PluginName, { plugin: PluginWrapper; isEnabled: boolean }>,
Expand Down