-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Deprecate kibana.index
setting
#83988
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d6a9e44
Deprecating `kibana.index` setting
kobelb cd8cb60
Using ela.st service so this can be changed to the blog in the future
kobelb b168af9
Adding unit tests
kobelb 81674af
Revising deprecation log message
kobelb e37fae5
Changing the deprecation log message to be more consistent with others
kobelb e406786
Merge remote-tracking branch 'upstream/master' into deprecate-kibana-…
kobelb 6cd2737
Updating kibana.index docs also
kobelb 9dc7532
Using rename deprecation as the "standard" for the deprecation messages
kobelb 21f2e68
Merge remote-tracking branch 'upstream/master' into deprecate-kibana-…
kobelb 74630ed
/s/'/`
kobelb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { config } from './kibana_config'; | ||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; | ||
|
||
const CONFIG_PATH = 'kibana'; | ||
|
||
const applyKibanaDeprecations = (settings: Record<string, any> = {}) => { | ||
const deprecations = config.deprecations!(configDeprecationFactory); | ||
const deprecationMessages: string[] = []; | ||
const _config: any = {}; | ||
_config[CONFIG_PATH] = settings; | ||
const migrated = applyDeprecations( | ||
_config, | ||
deprecations.map((deprecation) => ({ | ||
deprecation, | ||
path: CONFIG_PATH, | ||
})), | ||
(msg) => deprecationMessages.push(msg) | ||
); | ||
return { | ||
messages: deprecationMessages, | ||
migrated, | ||
}; | ||
}; | ||
|
||
it('set correct defaults ', () => { | ||
const configValue = config.schema.validate({}); | ||
expect(configValue).toMatchInlineSnapshot(` | ||
Object { | ||
"autocompleteTerminateAfter": "PT1M40S", | ||
"autocompleteTimeout": "PT1S", | ||
"enabled": true, | ||
"index": ".kibana", | ||
} | ||
`); | ||
}); | ||
|
||
describe('deprecations', () => { | ||
['.foo', '.kibana'].forEach((index) => { | ||
it('logs a warning if index is set', () => { | ||
const { messages } = applyKibanaDeprecations({ index }); | ||
expect(messages).toMatchInlineSnapshot(` | ||
Array [ | ||
"Setting [kibana.index] is deprecated. Multitenancy by changing 'kibana.index' will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details", | ||
] | ||
`); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remark: There is an inconsistency with the wording of our
unused
factory:kibana/packages/kbn-config/src/deprecation/deprecation_factory.ts
Line 90 in 5710f67
Setting [{config prop}] is deprecated
vs{config prop} is deprecated
.I also see that
rename
is using double quote around the config prop (whereunused
does not).kibana/packages/kbn-config/src/deprecation/deprecation_factory.ts
Line 47 in 5710f67
This is minor, but we might want to be consistent in our deprecation messages.
Also thinking: we may want to adapt
ConfigDeprecationFactory.unused
(and others) to accept a new optional 'message' parameter. That would also to log custom messages in deprecations without having to recode a custom one just to log the message (as it is done here forkibana.index
).unused('kibana.index', "Multitenancy by changing 'kibana.index' will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details")
This is probably out of the scope of this PR though. Should I create a separate issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed about being consistent here. I was originally replicating the format from the following deprecation log message, because I incorrectly assumed it used the "standard approach":
[warning][config][deprecation] Setting [elasticsearch.username] to "kibana" is deprecated. You should use the "kibana_system" user instead.
Do we want to follow the precedent set by
unused
and not use double-quotes, or should we follow the precedent set byrename
and use double-quotes?I think it's fine to support custom messages for
unused
/rename
. However, I don't think we should be using theunused
deprecation here, as this setting is still being used and has an effect, it's just deprecated. We use theunused
deprecation elsewhere when settings don't have an effect.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using quotes is slightly better, wdyt?
Yea, you're right. I forgot we are still using the value of this property. Nevermind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double-quotes sound good to me! I just independently decided that also and used it in 9dc7532