mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Deprecating `xpack.reporting.index` setting * Adding unit test * Now with more standard deprecation messages * Updating the xpack.reporting.index docs * Fixing tests Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
c142ac1c7e
commit
6be10bda5d
3 changed files with 55 additions and 1 deletions
|
@ -261,7 +261,9 @@ For information about {kib} memory limits, see <<production, using {kib} in a pr
|
|||
[cols="2*<"]
|
||||
|===
|
||||
| `xpack.reporting.index`
|
||||
| Reporting uses a weekly index in {es} to store the reporting job and
|
||||
| *deprecated* This setting is deprecated and will be removed in 8.0. Multitenancy by changing
|
||||
`kibana.index` will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy[8.0 Breaking Changes]
|
||||
for more details. Reporting uses a weekly index in {es} to store the reporting job and
|
||||
the report content. The index is automatically created if it does not already
|
||||
exist. Configure this to a unique value, beginning with `.reporting-`, for every
|
||||
{kib} instance that has a unique <<kibana-index, `kibana.index`>> setting. Defaults to `.reporting`.
|
||||
|
|
42
x-pack/plugins/reporting/server/config/index.test.ts
Normal file
42
x-pack/plugins/reporting/server/config/index.test.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { config } from './index';
|
||||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config';
|
||||
|
||||
const CONFIG_PATH = 'xpack.reporting';
|
||||
|
||||
const applyReportingDeprecations = (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,
|
||||
};
|
||||
};
|
||||
|
||||
describe('deprecations', () => {
|
||||
['.foo', '.reporting'].forEach((index) => {
|
||||
it('logs a warning if index is set', () => {
|
||||
const { messages } = applyReportingDeprecations({ index });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.reporting.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",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,6 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { get } from 'lodash';
|
||||
import { PluginConfigDescriptor } from 'kibana/server';
|
||||
import { ConfigSchema, ReportingConfigType } from './schema';
|
||||
export { buildConfig } from './config';
|
||||
|
@ -20,5 +21,14 @@ export const config: PluginConfigDescriptor<ReportingConfigType> = {
|
|||
unused('poll.jobCompletionNotifier.intervalErrorMultiplier'),
|
||||
unused('poll.jobsRefresh.intervalErrorMultiplier'),
|
||||
unused('kibanaApp'),
|
||||
(settings, fromPath, log) => {
|
||||
const reporting = get(settings, fromPath);
|
||||
if (reporting?.index) {
|
||||
log(
|
||||
`"${fromPath}.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`
|
||||
);
|
||||
}
|
||||
return settings;
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue