Deprecate APM OSS fleetMode
setting (#103721)
This has been enabled by default, and there isn't any remaining reason to turn it off. Mark it as deprecated and remove conditionals that check for it.
This commit is contained in:
parent
61d23665a9
commit
f039f8311f
|
@ -7,9 +7,11 @@
|
|||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { PluginInitializerContext } from '../../../core/server';
|
||||
import { ConfigDeprecationProvider, PluginInitializerContext } from '../../../core/server';
|
||||
import { APMOSSPlugin } from './plugin';
|
||||
|
||||
const deprecations: ConfigDeprecationProvider = ({ unused }) => [unused('fleetMode')];
|
||||
|
||||
export const config = {
|
||||
schema: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
|
@ -22,6 +24,7 @@ export const config = {
|
|||
indexPattern: schema.string({ defaultValue: 'apm-*' }),
|
||||
fleetMode: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
deprecations,
|
||||
};
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
|
|
|
@ -29,52 +29,14 @@ describe('mergeConfigs', () => {
|
|||
} as APMXPackConfig;
|
||||
|
||||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({
|
||||
'apm_oss.errorIndices': 'apm-*-error-*',
|
||||
'apm_oss.errorIndices': 'logs-apm*,apm-*-error-*',
|
||||
'apm_oss.indexPattern': 'apm-*',
|
||||
'apm_oss.metricsIndices': 'apm-*-metric-*',
|
||||
'apm_oss.spanIndices': 'apm-*-span-*',
|
||||
'apm_oss.transactionIndices': 'apm-*-transaction-*',
|
||||
'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*',
|
||||
'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*',
|
||||
'apm_oss.transactionIndices': 'traces-apm*,apm-*-transaction-*',
|
||||
'xpack.apm.metricsInterval': 2000,
|
||||
'xpack.apm.ui.enabled': false,
|
||||
'xpack.apm.agent.migrations.enabled': true,
|
||||
});
|
||||
});
|
||||
|
||||
it('adds fleet indices', () => {
|
||||
const apmOssConfig = {
|
||||
transactionIndices: 'apm-*-transaction-*',
|
||||
spanIndices: 'apm-*-span-*',
|
||||
errorIndices: 'apm-*-error-*',
|
||||
metricsIndices: 'apm-*-metric-*',
|
||||
fleetMode: true,
|
||||
} as APMOSSConfig;
|
||||
|
||||
const apmConfig = { ui: {}, agent: { migrations: {} } } as APMXPackConfig;
|
||||
|
||||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({
|
||||
'apm_oss.errorIndices': 'logs-apm*,apm-*-error-*',
|
||||
'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*',
|
||||
'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*',
|
||||
'apm_oss.transactionIndices': 'traces-apm*,apm-*-transaction-*',
|
||||
});
|
||||
});
|
||||
|
||||
it('does not add fleet indices', () => {
|
||||
const apmOssConfig = {
|
||||
transactionIndices: 'apm-*-transaction-*',
|
||||
spanIndices: 'apm-*-span-*',
|
||||
errorIndices: 'apm-*-error-*',
|
||||
metricsIndices: 'apm-*-metric-*',
|
||||
fleetMode: false,
|
||||
} as APMOSSConfig;
|
||||
|
||||
const apmConfig = { ui: {}, agent: { migrations: {} } } as APMXPackConfig;
|
||||
|
||||
expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({
|
||||
'apm_oss.errorIndices': 'apm-*-error-*',
|
||||
'apm_oss.metricsIndices': 'apm-*-metric-*',
|
||||
'apm_oss.spanIndices': 'apm-*-span-*',
|
||||
'apm_oss.transactionIndices': 'apm-*-transaction-*',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -102,23 +102,22 @@ export function mergeConfigs(
|
|||
'xpack.apm.agent.migrations.enabled': apmConfig.agent.migrations.enabled,
|
||||
};
|
||||
|
||||
if (apmOssConfig.fleetMode) {
|
||||
mergedConfig[
|
||||
'apm_oss.transactionIndices'
|
||||
] = `traces-apm*,${mergedConfig['apm_oss.transactionIndices']}`;
|
||||
// Add data stream indices to list of configured values
|
||||
mergedConfig[
|
||||
'apm_oss.transactionIndices'
|
||||
] = `traces-apm*,${mergedConfig['apm_oss.transactionIndices']}`;
|
||||
|
||||
mergedConfig[
|
||||
'apm_oss.spanIndices'
|
||||
] = `traces-apm*,${mergedConfig['apm_oss.spanIndices']}`;
|
||||
mergedConfig[
|
||||
'apm_oss.spanIndices'
|
||||
] = `traces-apm*,${mergedConfig['apm_oss.spanIndices']}`;
|
||||
|
||||
mergedConfig[
|
||||
'apm_oss.errorIndices'
|
||||
] = `logs-apm*,${mergedConfig['apm_oss.errorIndices']}`;
|
||||
mergedConfig[
|
||||
'apm_oss.errorIndices'
|
||||
] = `logs-apm*,${mergedConfig['apm_oss.errorIndices']}`;
|
||||
|
||||
mergedConfig[
|
||||
'apm_oss.metricsIndices'
|
||||
] = `metrics-apm*,${mergedConfig['apm_oss.metricsIndices']}`;
|
||||
}
|
||||
mergedConfig[
|
||||
'apm_oss.metricsIndices'
|
||||
] = `metrics-apm*,${mergedConfig['apm_oss.metricsIndices']}`;
|
||||
|
||||
return mergedConfig;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue