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

Conversation

nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Jun 26, 2020

Summary

Closes #54001

Adds log to existing log for unmet dependencies, to now include what unmet dependencies are missing.

[plugins-service] Plugin "securitySolution" has been disabled since the following direct or transitive dependencies are missing or disabled: ["ingestManager"]

@nickofthyme nickofthyme requested review from joshdover and afharo June 26, 2020 17:03
@nickofthyme nickofthyme requested a review from a team as a code owner June 26, 2020 17:03
config/kibana.yml Outdated Show resolved Hide resolved
@nickofthyme nickofthyme added release_note:skip Skip the PR/issue when compiling release notes v7.9.0 v8.0.0 labels Jun 26, 2020
Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

I'll let @dover to review this. Since it's under his expertise :)

Thanks @nickofthyme for doing this so quickly! ❤️

@nickofthyme nickofthyme marked this pull request as draft June 26, 2020 17:10
@nickofthyme
Copy link
Contributor Author

@joshdover I updated the existing tests for missing plugins. Let me know if you want any other tests to be added.

@nickofthyme nickofthyme requested a review from joshdover June 26, 2020 18:49
@nickofthyme nickofthyme changed the title build: add more detailed unmet deps logging Add more detailed unmet deps logging Jun 26, 2020
@nickofthyme nickofthyme marked this pull request as ready for review June 26, 2020 18:53
],
Array [
"Plugin \\"plugin-with-disabled-transitive-dep\\" has been disabled since some of its direct or transitive dependencies are missing or disabled.",
"Plugin \\"plugin-with-disabled-transitive-dep\\" has been disabled since the following direct or transitive dependencies are missing or disabled: [\\"another-explicitly-disabled-plugin\\"]",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a plugin to this test that has missing optional dependencies to validate that this log does not disable or log optional dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

5d1b4e5

I also added some for nested/indirect dependencies.

@@ -257,17 +264,28 @@ export class PluginsService implements CoreService<PluginsServiceSetup, PluginsS
pluginName: PluginName,
pluginEnableStatuses: Map<PluginName, { plugin: PluginWrapper; isEnabled: boolean }>,
parents: PluginName[] = []
): boolean {
): { enabled: boolean; missingDependencies: string[] } {
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to change this return type to:

{ enabled: true } | { enabled: false; missingDependencies: string[] }

This helps us avoid bugs where we have a state that should be impossible, like:

{ enabled: true, missingDependencies: ['some-dep'] }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nickofthyme nickofthyme requested a review from joshdover June 26, 2020 20:49
@nickofthyme
Copy link
Contributor Author

@elasticmachine merge upstream

@nickofthyme
Copy link
Contributor Author

@joshdover could you do one last pass on this, thanks!

Comment on lines 248 to 250
`Plugin "${pluginName}" has been disabled since the following direct or transitive dependencies are missing or disabled: ${JSON.stringify(
pluginEnablement.missingDependencies
)}`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we generally avoid using JSON.stringify and prefer using the .join method:

Suggested change
`Plugin "${pluginName}" has been disabled since the following direct or transitive dependencies are missing or disabled: ${JSON.stringify(
pluginEnablement.missingDependencies
)}`
`Plugin "${pluginName}" has been disabled since the following direct or transitive dependencies are missing or disabled: [${pluginEnablement.missingDependencies.join(', ')}]`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-oss-agent / Plugin Functional Tests.test/plugin_functional/test_suites/core_plugins/logging·ts.core plugins plugin logging writes info_pattern context to custom pattern appender

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 3 times on tracked branches: https://github.com/elastic/kibana/issues/70149

[00:00:00]       │
[00:01:18]         └-: core plugins
[00:01:18]           └-> "before all" hook
[00:03:51]           └-: plugin logging
[00:03:51]             └-> "before all" hook
[00:03:51]             └-> does not write to custom appenders when not configured
[00:03:51]               └-> "before each" hook: global before each
[00:03:51]               └-> "before each" hook
[00:03:51]               │ proc [kibana]   log   [17:56:56.517] [info][core_logging][debug_json][plugins] i go to the default appender!
[00:03:51]               └- ✓ pass  (48ms) "core plugins plugin logging does not write to custom appenders when not configured"
[00:03:51]             └-> writes debug_json context to custom JSON appender
[00:03:51]               └-> "before each" hook: global before each
[00:03:51]               └-> "before each" hook
[00:03:51]               └- ✓ pass  (40ms) "core plugins plugin logging writes debug_json context to custom JSON appender"
[00:03:51]             └-> writes info_json context to custom JSON appender
[00:03:51]               └-> "before each" hook: global before each
[00:03:51]               └-> "before each" hook
[00:03:51]               └- ✓ pass  (38ms) "core plugins plugin logging writes info_json context to custom JSON appender"
[00:03:51]             └-> writes debug_pattern context to custom pattern appender
[00:03:51]               └-> "before each" hook: global before each
[00:03:51]               └-> "before each" hook
[00:03:51]               └- ✓ pass  (34ms) "core plugins plugin logging writes debug_pattern context to custom pattern appender"
[00:03:51]             └-> writes info_pattern context to custom pattern appender
[00:03:51]               └-> "before each" hook: global before each
[00:03:51]               └-> "before each" hook
[00:03:51]               │ info Taking screenshot "/dev/shm/workspace/kibana/test/functional/screenshots/failure/core plugins plugin logging writes info_pattern context to custom pattern appender.png"
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [dev_tools] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[INFO] http://localhost:6121/9007199254740991/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 444:106112 "INFO: 2020-07-01T17:56:56Z
[00:03:52]               │        Adding connection to http://localhost:6121/elasticsearch
[00:03:52]               │
[00:03:52]               │      "
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [management] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [rendering] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [custom-app-route] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [chromeless] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [appleave1] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [appleave2] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [foo] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[WARNING] http://localhost:6121/9007199254740991/bundles/core_legacy_compat.bundle.js 2495:20 "App [bar] is using deprecated mount context. Use core.getStartServices() instead."
[00:03:52]               │ debg browser[DEBUG] http://localhost:6121/9007199254740991/bundles/plugin/usageCollection/usageCollection.plugin.js 950:16 "Reporting user-agent."
[00:03:52]               │ debg browser[DEBUG] http://localhost:6121/9007199254740991/bundles/plugin/usageCollection/usageCollection.plugin.js 950:16 "Reporting application changed to core_legacy_compat"
[00:03:52]               │ info Current URL is: http://localhost:6121/app/core_legacy_compat
[00:03:52]               │ info Saving page source to: /dev/shm/workspace/kibana/test/plugin_functional/failure_debug/html/core plugins plugin logging writes info_pattern context to custom pattern appender.html
[00:03:52]               └- ✖ fail: "core plugins plugin logging writes info_pattern context to custom pattern appender"
[00:03:52]               │

Stack Trace

{ Error: expected [ '' ] to sort of equal [ 'CUSTOM - PATTERN [plugins.core_logging.info_pattern][INFO ] log2' ]
    at Assertion.assert (packages/kbn-expect/expect.js:100:11)
    at Assertion.eql (packages/kbn-expect/expect.js:244:8)
    at Context.it (test/plugin_functional/test_suites/core_plugins/logging.ts:119:53)
  actual: '[\n  ""\n]',
  expected:
   '[\n  "CUSTOM - PATTERN [plugins.core_logging.info_pattern][INFO ] log2"\n]',
  showDiff: true }

Build metrics

✅ unchanged

History

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

@nickofthyme nickofthyme merged commit b37b6ed into elastic:master Jul 1, 2020
@nickofthyme nickofthyme deleted the unmet-deps-log branch July 1, 2020 19:01
nickofthyme added a commit to nickofthyme/kibana that referenced this pull request Jul 2, 2020
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.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide details why plugin disabled
5 participants