From af64ec43812003667b4bcf8a266f8f41a2baeab6 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Wed, 29 Sep 2021 04:27:02 -0400 Subject: [PATCH 01/17] [APM] Removes the apm_oss plugin and deprecates related configs (#108160) --- src/plugins/apm_oss/README.asciidoc | 5 -- src/plugins/apm_oss/kibana.json | 13 --- src/plugins/apm_oss/public/index.ts | 16 ---- src/plugins/apm_oss/public/plugin.ts | 22 ----- src/plugins/apm_oss/public/types.ts | 16 ---- src/plugins/apm_oss/server/index.ts | 40 ---------- src/plugins/apm_oss/server/plugin.ts | 30 ------- src/plugins/apm_oss/tsconfig.json | 17 ---- x-pack/plugins/apm/kibana.json | 1 - .../app/Settings/ApmIndices/index.tsx | 14 ++-- .../templates/settings_template.test.tsx | 1 + x-pack/plugins/apm/server/index.test.ts | 8 +- x-pack/plugins/apm/server/index.ts | 80 ++++++++++++------- .../unpack_processor_events.test.ts | 6 ++ .../unpack_processor_events.ts | 10 +-- .../server/lib/helpers/setup_request.test.ts | 6 ++ .../settings/apm_indices/get_apm_indices.ts | 59 ++++++++++---- x-pack/plugins/apm/server/plugin.ts | 6 +- .../apm/server/routes/settings/apm_indices.ts | 6 ++ .../apm/server/saved_objects/apm_indices.ts | 18 +++++ x-pack/plugins/apm/server/types.ts | 6 -- x-pack/plugins/apm/tsconfig.json | 1 - .../plugins/observability/common/typings.ts | 9 +++ 23 files changed, 157 insertions(+), 233 deletions(-) delete mode 100644 src/plugins/apm_oss/README.asciidoc delete mode 100644 src/plugins/apm_oss/kibana.json delete mode 100644 src/plugins/apm_oss/public/index.ts delete mode 100644 src/plugins/apm_oss/public/plugin.ts delete mode 100644 src/plugins/apm_oss/public/types.ts delete mode 100644 src/plugins/apm_oss/server/index.ts delete mode 100644 src/plugins/apm_oss/server/plugin.ts delete mode 100644 src/plugins/apm_oss/tsconfig.json diff --git a/src/plugins/apm_oss/README.asciidoc b/src/plugins/apm_oss/README.asciidoc deleted file mode 100644 index c3c060a99ee27..0000000000000 --- a/src/plugins/apm_oss/README.asciidoc +++ /dev/null @@ -1,5 +0,0 @@ -# APM OSS plugin - -OSS plugin for APM. Includes index configuration and tutorial resources. - -See <<../../x-pack/plugins/apm/readme.md,the X-Pack APM plugin README>> for information about the main APM plugin. diff --git a/src/plugins/apm_oss/kibana.json b/src/plugins/apm_oss/kibana.json deleted file mode 100644 index f18b275add9e3..0000000000000 --- a/src/plugins/apm_oss/kibana.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "id": "apmOss", - "owner": { - "name": "APM UI", - "githubTeam": "apm-ui" - }, - "version": "8.0.0", - "server": true, - "kibanaVersion": "kibana", - "configPath": ["apm_oss"], - "ui": true, - "requiredPlugins": ["home"] -} diff --git a/src/plugins/apm_oss/public/index.ts b/src/plugins/apm_oss/public/index.ts deleted file mode 100644 index fea8ac4a8a1e4..0000000000000 --- a/src/plugins/apm_oss/public/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { ApmOssPlugin } from './plugin'; - -// This exports static code and TypeScript types, -// as well as, Kibana Platform `plugin()` initializer. -export function plugin() { - return new ApmOssPlugin(); -} -export { ApmOssPluginSetup, ApmOssPluginStart } from './types'; diff --git a/src/plugins/apm_oss/public/plugin.ts b/src/plugins/apm_oss/public/plugin.ts deleted file mode 100644 index e6981954b301a..0000000000000 --- a/src/plugins/apm_oss/public/plugin.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { CoreSetup, CoreStart, Plugin } from 'kibana/public'; -import { ApmOssPluginSetup, ApmOssPluginStart } from './types'; - -export class ApmOssPlugin implements Plugin { - public setup(core: CoreSetup): ApmOssPluginSetup { - return {}; - } - - public start(core: CoreStart): ApmOssPluginStart { - return {}; - } - - public stop() {} -} diff --git a/src/plugins/apm_oss/public/types.ts b/src/plugins/apm_oss/public/types.ts deleted file mode 100644 index 16a1fe8be8004..0000000000000 --- a/src/plugins/apm_oss/public/types.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ApmOssPluginSetup {} - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface ApmOssPluginStart {} - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AppPluginStartDependencies {} diff --git a/src/plugins/apm_oss/server/index.ts b/src/plugins/apm_oss/server/index.ts deleted file mode 100644 index f2f6777672e33..0000000000000 --- a/src/plugins/apm_oss/server/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { schema, TypeOf } from '@kbn/config-schema'; -import { ConfigDeprecationProvider, PluginInitializerContext } from '../../../core/server'; -import { APMOSSPlugin } from './plugin'; - -const deprecations: ConfigDeprecationProvider = ({ deprecate, unused }) => [ - deprecate('enabled', '8.0.0'), - unused('fleetMode'), - unused('indexPattern'), -]; - -export const config = { - schema: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - transactionIndices: schema.string({ defaultValue: 'apm-*' }), - spanIndices: schema.string({ defaultValue: 'apm-*' }), - errorIndices: schema.string({ defaultValue: 'apm-*' }), - metricsIndices: schema.string({ defaultValue: 'apm-*' }), - sourcemapIndices: schema.string({ defaultValue: 'apm-*' }), - onboardingIndices: schema.string({ defaultValue: 'apm-*' }), - indexPattern: schema.string({ defaultValue: 'apm-*' }), - fleetMode: schema.boolean({ defaultValue: true }), - }), - deprecations, -}; - -export function plugin(initializerContext: PluginInitializerContext) { - return new APMOSSPlugin(initializerContext); -} - -export type APMOSSConfig = TypeOf; - -export { APMOSSPluginSetup } from './plugin'; diff --git a/src/plugins/apm_oss/server/plugin.ts b/src/plugins/apm_oss/server/plugin.ts deleted file mode 100644 index 02a8ac38be2a3..0000000000000 --- a/src/plugins/apm_oss/server/plugin.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { Observable } from 'rxjs'; -import { Plugin, PluginInitializerContext } from 'src/core/server'; -import { APMOSSConfig } from './'; - -export class APMOSSPlugin implements Plugin { - constructor(private readonly initContext: PluginInitializerContext) { - this.initContext = initContext; - } - public setup() { - const config$ = this.initContext.config.create(); - const config = this.initContext.config.get(); - return { config, config$ }; - } - - start() {} - stop() {} -} - -export interface APMOSSPluginSetup { - config: APMOSSConfig; - config$: Observable; -} diff --git a/src/plugins/apm_oss/tsconfig.json b/src/plugins/apm_oss/tsconfig.json deleted file mode 100644 index 08ed86d5da0a8..0000000000000 --- a/src/plugins/apm_oss/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*", - // have to declare *.json explicitly due to https://github.com/microsoft/TypeScript/issues/25636 - "server/tutorial/index_pattern.json" - ], - "references": [{ "path": "../../core/tsconfig.json" }, { "path": "../home/tsconfig.json" }] -} diff --git a/x-pack/plugins/apm/kibana.json b/x-pack/plugins/apm/kibana.json index 5bc365e35cb2f..dd4d3b1abf81f 100644 --- a/x-pack/plugins/apm/kibana.json +++ b/x-pack/plugins/apm/kibana.json @@ -7,7 +7,6 @@ "version": "8.0.0", "kibanaVersion": "kibana", "requiredPlugins": [ - "apmOss", "data", "embeddable", "features", diff --git a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx index 2d74187f9d83b..dd7c491598f14 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx @@ -30,40 +30,40 @@ import { const APM_INDEX_LABELS = [ { - configurationName: 'apm_oss.sourcemapIndices', + configurationName: 'xpack.apm.sourcemapIndices', label: i18n.translate( 'xpack.apm.settings.apmIndices.sourcemapIndicesLabel', { defaultMessage: 'Sourcemap Indices' } ), }, { - configurationName: 'apm_oss.errorIndices', + configurationName: 'xpack.apm.errorIndices', label: i18n.translate('xpack.apm.settings.apmIndices.errorIndicesLabel', { defaultMessage: 'Error Indices', }), }, { - configurationName: 'apm_oss.onboardingIndices', + configurationName: 'xpack.apm.onboardingIndices', label: i18n.translate( 'xpack.apm.settings.apmIndices.onboardingIndicesLabel', { defaultMessage: 'Onboarding Indices' } ), }, { - configurationName: 'apm_oss.spanIndices', + configurationName: 'xpack.apm.spanIndices', label: i18n.translate('xpack.apm.settings.apmIndices.spanIndicesLabel', { defaultMessage: 'Span Indices', }), }, { - configurationName: 'apm_oss.transactionIndices', + configurationName: 'xpack.apm.transactionIndices', label: i18n.translate( 'xpack.apm.settings.apmIndices.transactionIndicesLabel', { defaultMessage: 'Transaction Indices' } ), }, { - configurationName: 'apm_oss.metricsIndices', + configurationName: 'xpack.apm.metricsIndices', label: i18n.translate('xpack.apm.settings.apmIndices.metricsIndicesLabel', { defaultMessage: 'Metrics Indices', }), @@ -144,7 +144,7 @@ export function ApmIndices() { } ), }); - } catch (error) { + } catch (error: any) { notifications.toasts.addDanger({ title: i18n.translate( 'xpack.apm.settings.apmIndices.applyChanges.failed.title', diff --git a/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx b/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx index b760bb3125722..c717389361012 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx @@ -51,6 +51,7 @@ function Wrapper({ children }: { children?: ReactNode }) { ); } +// TODO describe('Settings', () => { it('renders', async () => { const routerProps = { diff --git a/x-pack/plugins/apm/server/index.test.ts b/x-pack/plugins/apm/server/index.test.ts index be93557fea6fc..10b958f26464e 100644 --- a/x-pack/plugins/apm/server/index.test.ts +++ b/x-pack/plugins/apm/server/index.test.ts @@ -7,27 +7,23 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { APMOSSConfig } from 'src/plugins/apm_oss/server'; import { APMXPackConfig } from '.'; import { mergeConfigs } from './index'; describe('mergeConfigs', () => { it('merges the configs', () => { - const apmOssConfig = { + const apmConfig = { transactionIndices: 'apm-*-transaction-*', spanIndices: 'apm-*-span-*', errorIndices: 'apm-*-error-*', metricsIndices: 'apm-*-metric-*', - } as APMOSSConfig; - - const apmConfig = { ui: { enabled: false }, enabled: true, metricsInterval: 2000, agent: { migrations: { enabled: true } }, } as APMXPackConfig; - expect(mergeConfigs(apmOssConfig, apmConfig)).toEqual({ + expect(mergeConfigs(apmConfig)).toEqual({ 'apm_oss.errorIndices': 'logs-apm*,apm-*-error-*', 'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*', 'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*', diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 2c21ff17f779b..bee1b8fff3514 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -10,7 +10,6 @@ import { PluginInitializerContext, PluginConfigDescriptor, } from 'src/core/server'; -import { APMOSSConfig } from 'src/plugins/apm_oss/server'; import { APMPlugin } from './plugin'; import { SearchAggregatedTransactionSetting } from '../common/aggregated_transactions'; @@ -48,11 +47,44 @@ const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: false }), }), }), + transactionIndices: schema.string({ + defaultValue: 'traces-apm*,apm-*-transaction-*', + }), + spanIndices: schema.string({ defaultValue: 'traces-apm*,apm-*-span-*' }), + errorIndices: schema.string({ defaultValue: 'logs-apm*,apm-*-error-*' }), + metricsIndices: schema.string({ + defaultValue: 'metrics-apm*,apm-*-metric-*', + }), + sourcemapIndices: schema.string({ defaultValue: 'apm-*-sourcemap-*' }), + onboardingIndices: schema.string({ defaultValue: 'apm-*-onboarding-*' }), + indexPattern: schema.string({ defaultValue: 'apm-*' }), + fleetMode: schema.boolean({ defaultValue: true }), }); // plugin config export const config: PluginConfigDescriptor = { - deprecations: ({ deprecate }) => [deprecate('enabled', '8.0.0')], + deprecations: ({ + deprecate, + renameFromRoot, + deprecateFromRoot, + unusedFromRoot, + }) => [ + deprecate('enabled', '8.0.0'), + renameFromRoot( + 'apm_oss.transactionIndices', + 'xpack.apm.transactionIndices' + ), + renameFromRoot('apm_oss.spanIndices', 'xpack.apm.spanIndices'), + renameFromRoot('apm_oss.errorIndices', 'xpack.apm.errorIndices'), + renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.metricsIndices'), + renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.sourcemapIndices'), + renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.onboardingIndices'), + renameFromRoot('apm_oss.indexPattern', 'xpack.apm.indexPattern'), + renameFromRoot('apm_oss.fleetMode', 'xpack.apm.fleetMode'), + deprecateFromRoot('apm_oss.enabled', '8.0.0'), + unusedFromRoot('apm_oss.fleetMode'), + unusedFromRoot('apm_oss.indexPattern'), + ], exposeToBrowser: { serviceMapEnabled: true, ui: true, @@ -65,19 +97,22 @@ export type APMXPackConfig = TypeOf; export type APMConfig = ReturnType; // plugin config and ui indices settings -export function mergeConfigs( - apmOssConfig: APMOSSConfig, - apmConfig: APMXPackConfig -) { +export function mergeConfigs(apmConfig: APMXPackConfig) { const mergedConfig = { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.transactionIndices': apmConfig.transactionIndices, + 'xpack.apm.spanIndices': apmConfig.spanIndices, + 'xpack.apm.errorIndices': apmConfig.errorIndices, + 'xpack.apm.metricsIndices': apmConfig.metricsIndices, + 'xpack.apm.sourcemapIndices': apmConfig.sourcemapIndices, + 'xpack.apm.onboardingIndices': apmConfig.onboardingIndices, // TODO: Remove all apm_oss options by 8.0 - 'apm_oss.transactionIndices': apmOssConfig.transactionIndices, - 'apm_oss.spanIndices': apmOssConfig.spanIndices, - 'apm_oss.errorIndices': apmOssConfig.errorIndices, - 'apm_oss.metricsIndices': apmOssConfig.metricsIndices, - 'apm_oss.sourcemapIndices': apmOssConfig.sourcemapIndices, - 'apm_oss.onboardingIndices': apmOssConfig.onboardingIndices, + 'apm_oss.transactionIndices': apmConfig.transactionIndices, + 'apm_oss.spanIndices': apmConfig.spanIndices, + 'apm_oss.errorIndices': apmConfig.errorIndices, + 'apm_oss.metricsIndices': apmConfig.metricsIndices, + 'apm_oss.sourcemapIndices': apmConfig.sourcemapIndices, + 'apm_oss.onboardingIndices': apmConfig.onboardingIndices, /* eslint-enable @typescript-eslint/naming-convention */ 'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled, 'xpack.apm.serviceMapFingerprintBucketSize': @@ -105,22 +140,11 @@ export function mergeConfigs( 'xpack.apm.agent.migrations.enabled': apmConfig.agent.migrations.enabled, }; - // 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.errorIndices' - ] = `logs-apm*,${mergedConfig['apm_oss.errorIndices']}`; - - mergedConfig[ - 'apm_oss.metricsIndices' - ] = `metrics-apm*,${mergedConfig['apm_oss.metricsIndices']}`; + // TODO make these default + // mergedConfig['apm_oss.transactionIndices'] = `traces-apm*,${mergedConfig['apm_oss.transactionIndices']}`; + // mergedConfig['apm_oss.spanIndices'] = `traces-apm*,${mergedConfig['apm_oss.spanIndices']}`; + // mergedConfig['apm_oss.errorIndices'] = `logs-apm*,${mergedConfig['apm_oss.errorIndices']}`; + // mergedConfig['apm_oss.metricsIndices'] = `metrics-apm*,${mergedConfig['apm_oss.metricsIndices']}`; return mergedConfig; } diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index 4983d6d515944..91d9f14e8cc07 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -19,6 +19,12 @@ describe('unpackProcessorEvents', () => { } as APMEventESSearchRequest; const indices = { + 'xpack.apm.transactionIndices': 'my-apm-*-transaction-*', + 'xpack.apm.metricsIndices': 'my-apm-*-metric-*', + 'xpack.apm.errorIndices': 'my-apm-*-error-*', + 'xpack.apm.spanIndices': 'my-apm-*-span-*', + 'xpack.apm.onboardingIndices': 'my-apm-*-onboarding-', + 'xpack.apm.sourcemapIndices': 'my-apm-*-sourcemap-*', 'apm_oss.transactionIndices': 'my-apm-*-transaction-*', 'apm_oss.metricsIndices': 'my-apm-*-metric-*', 'apm_oss.errorIndices': 'my-apm-*-error-*', diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 8732ba81f9ae6..8677e588d08e4 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -19,12 +19,12 @@ import { } from '../../../settings/apm_indices/get_apm_indices'; const processorEventIndexMap: Record = { - [ProcessorEvent.transaction]: 'apm_oss.transactionIndices', - [ProcessorEvent.span]: 'apm_oss.spanIndices', - [ProcessorEvent.metric]: 'apm_oss.metricsIndices', - [ProcessorEvent.error]: 'apm_oss.errorIndices', + [ProcessorEvent.transaction]: 'xpack.apm.transactionIndices', + [ProcessorEvent.span]: 'xpack.apm.spanIndices', + [ProcessorEvent.metric]: 'xpack.apm.metricsIndices', + [ProcessorEvent.error]: 'xpack.apm.errorIndices', // TODO: should have its own config setting - [ProcessorEvent.profile]: 'apm_oss.transactionIndices', + [ProcessorEvent.profile]: 'xpack.apm.transactionIndices', }; export function unpackProcessorEvents( diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index 94e88a09ea35c..643f84ad1dbfc 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -14,6 +14,12 @@ import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames'; jest.mock('../settings/apm_indices/get_apm_indices', () => ({ getApmIndices: async () => ({ /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': 'apm-*', + 'xpack.apm.errorIndices': 'apm-*', + 'xpack.apm.onboardingIndices': 'apm-*', + 'xpack.apm.spanIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', + 'xpack.apm.metricsIndices': 'apm-*', 'apm_oss.sourcemapIndices': 'apm-*', 'apm_oss.errorIndices': 'apm-*', 'apm_oss.onboardingIndices': 'apm-*', diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index 0ade96682b362..fc56223bbf285 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { merge } from 'lodash'; - import { SavedObjectsClient } from 'src/core/server'; import { PromiseReturnType } from '../../../../../observability/typings/common'; import { @@ -39,6 +37,12 @@ async function getApmIndicesSavedObject( export function getApmIndicesConfig(config: APMConfig): ApmIndicesConfig { return { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': config['xpack.apm.sourcemapIndices'], + 'xpack.apm.errorIndices': config['xpack.apm.errorIndices'], + 'xpack.apm.onboardingIndices': config['xpack.apm.onboardingIndices'], + 'xpack.apm.spanIndices': config['xpack.apm.spanIndices'], + 'xpack.apm.transactionIndices': config['xpack.apm.transactionIndices'], + 'xpack.apm.metricsIndices': config['xpack.apm.metricsIndices'], 'apm_oss.sourcemapIndices': config['apm_oss.sourcemapIndices'], 'apm_oss.errorIndices': config['apm_oss.errorIndices'], 'apm_oss.onboardingIndices': config['apm_oss.onboardingIndices'], @@ -64,19 +68,38 @@ export async function getApmIndices({ savedObjectsClient ); const apmIndicesConfig = getApmIndicesConfig(config); - return merge({}, apmIndicesConfig, apmIndicesSavedObject); + return mergeApmIndicesConfigs(apmIndicesConfig, apmIndicesSavedObject); } catch (error) { return getApmIndicesConfig(config); } } -const APM_UI_INDICES: ApmIndicesName[] = [ - 'apm_oss.sourcemapIndices', - 'apm_oss.errorIndices', - 'apm_oss.onboardingIndices', - 'apm_oss.spanIndices', - 'apm_oss.transactionIndices', - 'apm_oss.metricsIndices', +function mergeApmIndicesConfigs( + apmIndicesConfig: ApmIndicesConfig, + apmIndicesSavedObject: PromiseReturnType +) { + return APM_UI_INDICES.reduce( + (mergedConfigs, savedIndexConfig) => { + const savedApmIndex = + apmIndicesSavedObject[savedIndexConfig[0]] || + apmIndicesSavedObject[savedIndexConfig[1]]; // TODO remove deprecated apm_oss support in 8.0 + return { + ...mergedConfigs, + [savedIndexConfig[0]]: savedApmIndex, + [savedIndexConfig[1]]: savedApmIndex, + }; + }, + { ...apmIndicesConfig } + ); +} + +const APM_UI_INDICES: Array<[ApmIndicesName, ApmIndicesName]> = [ + ['xpack.apm.sourcemapIndices', 'apm_oss.sourcemapIndices'], + ['xpack.apm.errorIndices', 'apm_oss.errorIndices'], + ['xpack.apm.onboardingIndices', 'apm_oss.onboardingIndices'], + ['xpack.apm.spanIndices', 'apm_oss.spanIndices'], + ['xpack.apm.transactionIndices', 'apm_oss.transactionIndices'], + ['xpack.apm.metricsIndices', 'apm_oss.metricsIndices'], ]; export async function getApmIndexSettings({ @@ -88,7 +111,7 @@ export async function getApmIndexSettings({ apmIndicesSavedObject = await getApmIndicesSavedObject( context.core.savedObjects.client ); - } catch (error) { + } catch (error: any) { if (error.output && error.output.statusCode === 404) { apmIndicesSavedObject = {}; } else { @@ -97,9 +120,13 @@ export async function getApmIndexSettings({ } const apmIndicesConfig = getApmIndicesConfig(config); - return APM_UI_INDICES.map((configurationName) => ({ - configurationName, - defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml - savedValue: apmIndicesSavedObject[configurationName], // value saved via Saved Objects service - })); + return APM_UI_INDICES.map( + ([configurationName, deprecatedConfigurationName]) => ({ + configurationName, + defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml + savedValue: + apmIndicesSavedObject[configurationName] || + apmIndicesSavedObject[deprecatedConfigurationName], // value saved via Saved Objects service + }) + ); } diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 56185d846562f..1be5d5f4c0d40 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -5,7 +5,6 @@ * 2.0. */ -import { combineLatest } from 'rxjs'; import { map, take } from 'rxjs/operators'; import { CoreSetup, @@ -73,8 +72,8 @@ export class APMPlugin ) { this.logger = this.initContext.logger.get(); const config$ = this.initContext.config.create(); - const mergedConfig$ = combineLatest(plugins.apmOss.config$, config$).pipe( - map(([apmOssConfig, apmConfig]) => mergeConfigs(apmOssConfig, apmConfig)) + const mergedConfig$ = config$.pipe( + map((apmConfig) => mergeConfigs(apmConfig)) ); core.savedObjects.registerType(apmIndices); @@ -82,7 +81,6 @@ export class APMPlugin core.savedObjects.registerType(apmServerSettings); const currentConfig = mergeConfigs( - plugins.apmOss.config, this.initContext.config.get() ); this.currentConfig = currentConfig; diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index 003471aa89f39..872ab0afeb689 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -46,6 +46,12 @@ const saveApmIndicesRoute = createApmServerRoute({ params: t.type({ body: t.partial({ /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': t.string, + 'xpack.apm.errorIndices': t.string, + 'xpack.apm.onboardingIndices': t.string, + 'xpack.apm.spanIndices': t.string, + 'xpack.apm.transactionIndices': t.string, + 'xpack.apm.metricsIndices': t.string, 'apm_oss.sourcemapIndices': t.string, 'apm_oss.errorIndices': t.string, 'apm_oss.onboardingIndices': t.string, diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts index df5267023ae89..e652d9cb870a8 100644 --- a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts +++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts @@ -15,6 +15,24 @@ export const apmIndices: SavedObjectsType = { mappings: { properties: { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': { + type: 'keyword', + }, + 'xpack.apm.errorIndices': { + type: 'keyword', + }, + 'xpack.apm.onboardingIndices': { + type: 'keyword', + }, + 'xpack.apm.spanIndices': { + type: 'keyword', + }, + 'xpack.apm.transactionIndices': { + type: 'keyword', + }, + 'xpack.apm.metricsIndices': { + type: 'keyword', + }, 'apm_oss.sourcemapIndices': { type: 'keyword', }, diff --git a/x-pack/plugins/apm/server/types.ts b/x-pack/plugins/apm/server/types.ts index 325891d8c1d33..c686c42beb6ef 100644 --- a/x-pack/plugins/apm/server/types.ts +++ b/x-pack/plugins/apm/server/types.ts @@ -16,7 +16,6 @@ import { PluginStart as DataPluginStart, } from '../../../../src/plugins/data/server'; import { SpacesPluginSetup, SpacesPluginStart } from '../../spaces/server'; -import { APMOSSPluginSetup } from '../../../../src/plugins/apm_oss/server'; import { HomeServerPluginSetup, HomeServerPluginStart, @@ -71,10 +70,6 @@ interface DependencyMap { setup: SpacesPluginSetup; start: SpacesPluginStart; }; - apmOss: { - setup: APMOSSPluginSetup; - start: undefined; - }; home: { setup: HomeServerPluginSetup; start: HomeServerPluginStart; @@ -135,7 +130,6 @@ interface DependencyMap { const requiredDependencies = [ 'features', - 'apmOss', 'data', 'licensing', 'triggersActionsUi', diff --git a/x-pack/plugins/apm/tsconfig.json b/x-pack/plugins/apm/tsconfig.json index c1030d2a4be1d..5db20725dd785 100644 --- a/x-pack/plugins/apm/tsconfig.json +++ b/x-pack/plugins/apm/tsconfig.json @@ -19,7 +19,6 @@ ], "references": [ { "path": "../../../src/core/tsconfig.json" }, - { "path": "../../../src/plugins/apm_oss/tsconfig.json" }, { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/embeddable/tsconfig.json" }, { "path": "../../../src/plugins/home/tsconfig.json" }, diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index 71337075e1617..d2178f2c455ed 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -17,12 +17,21 @@ export type AlertWorkflowStatus = t.TypeOf; export interface ApmIndicesConfig { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': string; + 'xpack.apm.errorIndices': string; + 'xpack.apm.onboardingIndices': string; + 'xpack.apm.spanIndices': string; + 'xpack.apm.transactionIndices': string; + 'xpack.apm.metricsIndices': string; + + // includes deprecated indices from apm_oss path 'apm_oss.sourcemapIndices': string; 'apm_oss.errorIndices': string; 'apm_oss.onboardingIndices': string; 'apm_oss.spanIndices': string; 'apm_oss.transactionIndices': string; 'apm_oss.metricsIndices': string; + /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; From 7483967e3b913651d23daf2189477759fca2da0c Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Wed, 29 Sep 2021 04:28:47 -0400 Subject: [PATCH 02/17] removes commented lines --- x-pack/plugins/apm/server/index.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index bee1b8fff3514..f9aa67dd586cd 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -140,12 +140,6 @@ export function mergeConfigs(apmConfig: APMXPackConfig) { 'xpack.apm.agent.migrations.enabled': apmConfig.agent.migrations.enabled, }; - // TODO make these default - // mergedConfig['apm_oss.transactionIndices'] = `traces-apm*,${mergedConfig['apm_oss.transactionIndices']}`; - // mergedConfig['apm_oss.spanIndices'] = `traces-apm*,${mergedConfig['apm_oss.spanIndices']}`; - // mergedConfig['apm_oss.errorIndices'] = `logs-apm*,${mergedConfig['apm_oss.errorIndices']}`; - // mergedConfig['apm_oss.metricsIndices'] = `metrics-apm*,${mergedConfig['apm_oss.metricsIndices']}`; - return mergedConfig; } From d8d6a4ed3ccc086ec52dc71a3718c3268cc033e2 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Fri, 1 Oct 2021 11:23:01 -0400 Subject: [PATCH 03/17] fixes typescript errors --- .../plugins/apm/scripts/shared/read-kibana-config.ts | 6 ++++++ x-pack/plugins/apm/server/index.test.ts | 4 ++++ .../collect_data_telemetry/tasks.test.ts | 4 ++++ .../lib/errors/distribution/get_buckets.test.ts | 6 ++++++ .../create_static_index_pattern.test.ts | 4 ++++ .../get_apm_index_pattern_title.test.ts | 8 ++++++++ .../search_strategy_provider.test.ts | 1 + .../server/lib/transactions/breakdown/index.test.ts | 6 ++++++ x-pack/plugins/apm/server/utils/test_helpers.tsx | 12 ++++++++++++ 9 files changed, 51 insertions(+) diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index a85bd007bc4f3..9d08e49956350 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -39,6 +39,12 @@ export const readKibanaConfig = () => { return { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.transactionIndices': 'apm-*', + 'xpack.apm.metricsIndices': 'apm-*', + 'xpack.apm.errorIndices': 'apm-*', + 'xpack.apm.spanIndices': 'apm-*', + 'xpack.apm.onboardingIndices': 'apm-*', + 'xpack.apm.sourcemapIndices': 'apm-*', 'apm_oss.transactionIndices': 'apm-*', 'apm_oss.metricsIndices': 'apm-*', 'apm_oss.errorIndices': 'apm-*', diff --git a/x-pack/plugins/apm/server/index.test.ts b/x-pack/plugins/apm/server/index.test.ts index 10b958f26464e..33284028996fe 100644 --- a/x-pack/plugins/apm/server/index.test.ts +++ b/x-pack/plugins/apm/server/index.test.ts @@ -24,6 +24,10 @@ describe('mergeConfigs', () => { } as APMXPackConfig; expect(mergeConfigs(apmConfig)).toEqual({ + 'xpack.apm.errorIndices': 'logs-apm*,apm-*-error-*', + 'xpack.apm.metricsIndices': 'metrics-apm*,apm-*-metric-*', + 'xpack.apm.spanIndices': 'traces-apm*,apm-*-span-*', + 'xpack.apm.transactionIndices': 'traces-apm*,apm-*-transaction-*', 'apm_oss.errorIndices': 'logs-apm*,apm-*-error-*', 'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*', 'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*', diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index 4bfac442b4a3c..446efca5aff82 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -15,6 +15,10 @@ import { describe('data telemetry collection tasks', () => { const indices = { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.errorIndices': 'apm-8.0.0-error', + 'xpack.apm.metricsIndices': 'apm-8.0.0-metric', + 'xpack.apm.spanIndices': 'apm-8.0.0-span', + 'xpack.apm.transactionIndices': 'apm-8.0.0-transaction', 'apm_oss.errorIndices': 'apm-8.0.0-error', 'apm_oss.metricsIndices': 'apm-8.0.0-metric', 'apm_oss.spanIndices': 'apm-8.0.0-span', diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts index 809869e13de7f..deaf792ee2313 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts @@ -44,6 +44,12 @@ describe('get buckets', () => { ) as APMConfig, indices: { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': 'apm-*', + 'xpack.apm.errorIndices': 'apm-*', + 'xpack.apm.onboardingIndices': 'apm-*', + 'xpack.apm.spanIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', + 'xpack.apm.metricsIndices': 'apm-*', 'apm_oss.sourcemapIndices': 'apm-*', 'apm_oss.errorIndices': 'apm-*', 'apm_oss.onboardingIndices': 'apm-*', diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index aae707c6e4689..e8df39aaa7593 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -25,6 +25,10 @@ function getMockSavedObjectsClient(existingIndexPatternTitle: string) { const setup = { indices: { + 'xpack.apm.transactionIndices': 'apm-*-transaction-*', + 'xpack.apm.spanIndices': 'apm-*-span-*', + 'xpack.apm.errorIndices': 'apm-*-error-*', + 'xpack.apm.metricsIndices': 'apm-*-metrics-*', 'apm_oss.transactionIndices': 'apm-*-transaction-*', 'apm_oss.spanIndices': 'apm-*-span-*', 'apm_oss.errorIndices': 'apm-*-error-*', diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts index 8103630157584..f7432bede331b 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts @@ -13,6 +13,10 @@ import { getApmIndexPatternTitle } from './get_apm_index_pattern_title'; describe('getApmIndexPatternTitle', () => { it('returns an index pattern title by combining existing indicies', () => { const title = getApmIndexPatternTitle({ + 'xpack.apm.transactionIndices': 'apm-*-transaction-*', + 'xpack.apm.spanIndices': 'apm-*-span-*', + 'xpack.apm.errorIndices': 'apm-*-error-*', + 'xpack.apm.metricsIndices': 'apm-*-metrics-*', 'apm_oss.transactionIndices': 'apm-*-transaction-*', 'apm_oss.spanIndices': 'apm-*-span-*', 'apm_oss.errorIndices': 'apm-*-error-*', @@ -25,6 +29,10 @@ describe('getApmIndexPatternTitle', () => { it('removes duplicates', () => { const title = getApmIndexPatternTitle({ + 'xpack.apm.transactionIndices': 'apm-*', + 'xpack.apm.spanIndices': 'apm-*', + 'xpack.apm.errorIndices': 'apm-*', + 'xpack.apm.metricsIndices': 'apm-*', 'apm_oss.transactionIndices': 'apm-*', 'apm_oss.spanIndices': 'apm-*', 'apm_oss.errorIndices': 'apm-*', diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts index 6e03c879f9b97..0b203b10f1310 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts @@ -92,6 +92,7 @@ const clientSearchMock = ( const getApmIndicesMock = async () => ({ // eslint-disable-next-line @typescript-eslint/naming-convention + 'xpack.apm.transactionIndices': 'apm-*', 'apm_oss.transactionIndices': 'apm-*', } as ApmIndicesConfig); diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index 6e9d0aad96b71..7f2a3a4ec7019 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -14,6 +14,12 @@ import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; const mockIndices = { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': 'myIndex', + 'xpack.apm.errorIndices': 'myIndex', + 'xpack.apm.onboardingIndices': 'myIndex', + 'xpack.apm.spanIndices': 'myIndex', + 'xpack.apm.transactionIndices': 'myIndex', + 'xpack.apm.metricsIndices': 'myIndex', 'apm_oss.sourcemapIndices': 'myIndex', 'apm_oss.errorIndices': 'myIndex', 'apm_oss.onboardingIndices': 'myIndex', diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 7b6b549e07c8d..3fc11b40bc1a5 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -28,6 +28,12 @@ interface MockSetup { uiFilters: UxUIFilters; indices: { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': string; + 'xpack.apm.errorIndices': string; + 'xpack.apm.onboardingIndices': string; + 'xpack.apm.spanIndices': string; + 'xpack.apm.transactionIndices': string; + 'xpack.apm.metricsIndices': string; 'apm_oss.sourcemapIndices': string; 'apm_oss.errorIndices': string; 'apm_oss.onboardingIndices': string; @@ -86,6 +92,12 @@ export async function inspectSearchParams( uiFilters: options?.uiFilters ?? {}, indices: { /* eslint-disable @typescript-eslint/naming-convention */ + 'xpack.apm.sourcemapIndices': 'myIndex', + 'xpack.apm.errorIndices': 'myIndex', + 'xpack.apm.onboardingIndices': 'myIndex', + 'xpack.apm.spanIndices': 'myIndex', + 'xpack.apm.transactionIndices': 'myIndex', + 'xpack.apm.metricsIndices': 'myIndex', 'apm_oss.sourcemapIndices': 'myIndex', 'apm_oss.errorIndices': 'myIndex', 'apm_oss.onboardingIndices': 'myIndex', From a5d2013beb8e45d7f01dff2761272461f83cb0b4 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Fri, 1 Oct 2021 16:48:02 -0400 Subject: [PATCH 04/17] performs start up migration on the saved objects mapping for apm-indices --- .../templates/settings_template.test.tsx | 1 - .../apm/server/saved_objects/apm_indices.ts | 25 ++++-------- .../migrations/update_apm_oss_index_paths.ts | 39 +++++++++++++++++++ 3 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts diff --git a/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx b/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx index c717389361012..b760bb3125722 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/settings_template.test.tsx @@ -51,7 +51,6 @@ function Wrapper({ children }: { children?: ReactNode }) { ); } -// TODO describe('Settings', () => { it('renders', async () => { const routerProps = { diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts index e652d9cb870a8..ff7453a4b965e 100644 --- a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts +++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts @@ -7,6 +7,7 @@ import { SavedObjectsType } from 'src/core/server'; import { i18n } from '@kbn/i18n'; +import { updateApmOssIndexPaths } from './migrations/update_apm_oss_index_paths'; export const apmIndices: SavedObjectsType = { name: 'apm-indices', @@ -33,24 +34,6 @@ export const apmIndices: SavedObjectsType = { 'xpack.apm.metricsIndices': { type: 'keyword', }, - 'apm_oss.sourcemapIndices': { - type: 'keyword', - }, - 'apm_oss.errorIndices': { - type: 'keyword', - }, - 'apm_oss.onboardingIndices': { - type: 'keyword', - }, - 'apm_oss.spanIndices': { - type: 'keyword', - }, - 'apm_oss.transactionIndices': { - type: 'keyword', - }, - 'apm_oss.metricsIndices': { - type: 'keyword', - }, }, }, management: { @@ -61,4 +44,10 @@ export const apmIndices: SavedObjectsType = { defaultMessage: 'APM Settings - Index', }), }, + migrations: { + '7.16.0': (doc) => { + const attributes = updateApmOssIndexPaths(doc.attributes); + return { ...doc, attributes }; + }, + }, }; diff --git a/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts new file mode 100644 index 0000000000000..5999a37ee44b1 --- /dev/null +++ b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +const apmIndexConfigPaths = [ + ['xpack.apm.sourcemapIndices', 'apm_oss.sourcemapIndices'], + ['xpack.apm.errorIndices', 'apm_oss.errorIndices'], + ['xpack.apm.onboardingIndices', 'apm_oss.onboardingIndices'], + ['xpack.apm.spanIndices', 'apm_oss.spanIndices'], + ['xpack.apm.transactionIndices', 'apm_oss.transactionIndices'], + ['xpack.apm.metricsIndices', 'apm_oss.metricsIndices'], +] as const; + +type ApmIndexConfigsPaths = typeof apmIndexConfigPaths[number][0]; +type ApmIndicesSavedObjectAttributes = Partial<{ + [Property in ApmIndexConfigsPaths]: string; +}>; +type DeprecatedApmIndexConfigsPaths = typeof apmIndexConfigPaths[number][1]; +type DeprecatedApmIndicesSavedObjectAttributes = Partial<{ + [Property in DeprecatedApmIndexConfigsPaths]: string; +}>; + +export function updateApmOssIndexPaths( + attributes: DeprecatedApmIndicesSavedObjectAttributes +) { + return apmIndexConfigPaths.reduce( + (attrs, [configPath, deprecatedConfigPath]) => { + const indexConfig: string | undefined = attributes[deprecatedConfigPath]; + if (indexConfig) { + attrs[configPath] = indexConfig; + } + return attrs; + }, + {} as ApmIndicesSavedObjectAttributes + ); +} From b763ccd1bf71050b82e6521c0ccd5d2ecf199598 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Fri, 1 Oct 2021 17:49:37 -0400 Subject: [PATCH 05/17] removes all references to the deprecated apm_oss.* config paths in APM --- .../integration/power_user/no_data_screen.ts | 24 +++--- .../plugins/apm/public/utils/testHelpers.tsx | 24 +++--- .../apm/scripts/shared/read-kibana-config.ts | 6 -- x-pack/plugins/apm/server/index.test.ts | 12 +-- x-pack/plugins/apm/server/index.ts | 7 -- .../alerts/register_error_count_alert_type.ts | 2 +- ...egister_transaction_duration_alert_type.ts | 4 +- ...ister_transaction_error_rate_alert_type.ts | 4 +- .../apm/server/lib/alerts/test_utils/index.ts | 4 +- .../create_anomaly_detection_jobs.ts | 2 +- .../collect_data_telemetry/tasks.test.ts | 4 - .../collect_data_telemetry/tasks.ts | 78 +++++++++---------- .../errors/distribution/get_buckets.test.ts | 6 -- .../unpack_processor_events.test.ts | 6 -- .../server/lib/helpers/setup_request.test.ts | 6 -- .../create_static_index_pattern.test.ts | 4 - .../get_apm_index_pattern_title.test.ts | 8 -- .../get_apm_index_pattern_title.ts | 8 +- .../apm/server/lib/rum_client/has_rum_data.ts | 4 +- ...ransactions_correlations_search_service.ts | 2 +- .../latency_correlations_search_service.ts | 2 +- .../search_strategy_provider.test.ts | 1 - .../settings/apm_indices/get_apm_indices.ts | 57 ++++---------- .../lib/transactions/breakdown/index.test.ts | 6 -- .../apm/server/routes/settings/apm_indices.ts | 7 -- .../apm/server/tutorial/envs/on_prem.ts | 16 ++-- .../plugins/apm/server/utils/test_helpers.tsx | 12 --- .../plugins/observability/common/typings.ts | 8 -- .../hooks/use_app_index_pattern.tsx | 2 +- .../public/context/has_data_context.test.tsx | 2 +- .../observability/public/data_handler.test.ts | 2 +- .../pages/overview/overview.stories.tsx | 2 +- .../encrypted_saved_objects/mappings.json | 40 +++++----- .../mappings.json | 40 +++++----- .../es_archiver/key_rotation/mappings.json | 40 +++++----- 35 files changed, 174 insertions(+), 278 deletions(-) diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts index 2d5c2a6f16228..9e8af6f39f659 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts @@ -20,12 +20,12 @@ describe('No data screen', () => { url: apmIndicesSaveURL, method: 'POST', body: { - 'apm_oss.sourcemapIndices': 'foo-*', - 'apm_oss.errorIndices': 'foo-*', - 'apm_oss.onboardingIndices': 'foo-*', - 'apm_oss.spanIndices': 'foo-*', - 'apm_oss.transactionIndices': 'foo-*', - 'apm_oss.metricsIndices': 'foo-*', + 'xpack.apm.sourcemapIndices': 'foo-*', + 'xpack.apm.errorIndices': 'foo-*', + 'xpack.apm.onboardingIndices': 'foo-*', + 'xpack.apm.spanIndices': 'foo-*', + 'xpack.apm.transactionIndices': 'foo-*', + 'xpack.apm.metricsIndices': 'foo-*', }, headers: { 'kbn-xsrf': true, @@ -50,12 +50,12 @@ describe('No data screen', () => { url: apmIndicesSaveURL, method: 'POST', body: { - 'apm_oss.sourcemapIndices': '', - 'apm_oss.errorIndices': '', - 'apm_oss.onboardingIndices': '', - 'apm_oss.spanIndices': '', - 'apm_oss.transactionIndices': '', - 'apm_oss.metricsIndices': '', + 'xpack.apm.sourcemapIndices': '', + 'xpack.apm.errorIndices': '', + 'xpack.apm.onboardingIndices': '', + 'xpack.apm.spanIndices': '', + 'xpack.apm.transactionIndices': '', + 'xpack.apm.metricsIndices': '', }, headers: { 'kbn-xsrf': true }, auth: { user: 'apm_power_user', pass: 'changeme' }, diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx index 8764ac48c5440..b8b80370bddaa 100644 --- a/x-pack/plugins/apm/public/utils/testHelpers.tsx +++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx @@ -120,12 +120,12 @@ interface MockSetup { uiFilters: UxUIFilters; indices: { /* eslint-disable @typescript-eslint/naming-convention */ - 'apm_oss.sourcemapIndices': string; - 'apm_oss.errorIndices': string; - 'apm_oss.onboardingIndices': string; - 'apm_oss.spanIndices': string; - 'apm_oss.transactionIndices': string; - 'apm_oss.metricsIndices': string; + 'xpack.apm.sourcemapIndices': string; + 'xpack.apm.errorIndices': string; + 'xpack.apm.onboardingIndices': string; + 'xpack.apm.spanIndices': string; + 'xpack.apm.transactionIndices': string; + 'xpack.apm.metricsIndices': string; /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; @@ -179,12 +179,12 @@ export async function inspectSearchParams( uiFilters: {}, indices: { /* eslint-disable @typescript-eslint/naming-convention */ - 'apm_oss.sourcemapIndices': 'myIndex', - 'apm_oss.errorIndices': 'myIndex', - 'apm_oss.onboardingIndices': 'myIndex', - 'apm_oss.spanIndices': 'myIndex', - 'apm_oss.transactionIndices': 'myIndex', - 'apm_oss.metricsIndices': 'myIndex', + 'xpack.apm.sourcemapIndices': 'myIndex', + 'xpack.apm.errorIndices': 'myIndex', + 'xpack.apm.onboardingIndices': 'myIndex', + 'xpack.apm.spanIndices': 'myIndex', + 'xpack.apm.transactionIndices': 'myIndex', + 'xpack.apm.metricsIndices': 'myIndex', /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index 9d08e49956350..668fb29c13543 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -45,12 +45,6 @@ export const readKibanaConfig = () => { 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.onboardingIndices': 'apm-*', 'xpack.apm.sourcemapIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', - 'apm_oss.metricsIndices': 'apm-*', - 'apm_oss.errorIndices': 'apm-*', - 'apm_oss.spanIndices': 'apm-*', - 'apm_oss.onboardingIndices': 'apm-*', - 'apm_oss.sourcemapIndices': 'apm-*', /* eslint-enable @typescript-eslint/naming-convention */ 'elasticsearch.hosts': 'http://localhost:9200', ...loadedKibanaConfig, diff --git a/x-pack/plugins/apm/server/index.test.ts b/x-pack/plugins/apm/server/index.test.ts index 33284028996fe..bb105bdfe6532 100644 --- a/x-pack/plugins/apm/server/index.test.ts +++ b/x-pack/plugins/apm/server/index.test.ts @@ -13,10 +13,10 @@ import { mergeConfigs } from './index'; describe('mergeConfigs', () => { it('merges the configs', () => { const apmConfig = { - transactionIndices: 'apm-*-transaction-*', - spanIndices: 'apm-*-span-*', - errorIndices: 'apm-*-error-*', - metricsIndices: 'apm-*-metric-*', + transactionIndices: 'traces-apm*,apm-*-transaction-*', + spanIndices: 'traces-apm*,apm-*-span-*', + errorIndices: 'logs-apm*,apm-*-error-*', + metricsIndices: 'metrics-apm*,apm-*-metric-*', ui: { enabled: false }, enabled: true, metricsInterval: 2000, @@ -28,10 +28,6 @@ describe('mergeConfigs', () => { 'xpack.apm.metricsIndices': 'metrics-apm*,apm-*-metric-*', 'xpack.apm.spanIndices': 'traces-apm*,apm-*-span-*', 'xpack.apm.transactionIndices': 'traces-apm*,apm-*-transaction-*', - '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-*', 'xpack.apm.metricsInterval': 2000, 'xpack.apm.ui.enabled': false, 'xpack.apm.agent.migrations.enabled': true, diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index efafdbd79d7ad..e9e8b9965f36b 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -113,13 +113,6 @@ export function mergeConfigs(apmConfig: APMXPackConfig) { 'xpack.apm.metricsIndices': apmConfig.metricsIndices, 'xpack.apm.sourcemapIndices': apmConfig.sourcemapIndices, 'xpack.apm.onboardingIndices': apmConfig.onboardingIndices, - // TODO: Remove all apm_oss options by 8.0 - 'apm_oss.transactionIndices': apmConfig.transactionIndices, - 'apm_oss.spanIndices': apmConfig.spanIndices, - 'apm_oss.errorIndices': apmConfig.errorIndices, - 'apm_oss.metricsIndices': apmConfig.metricsIndices, - 'apm_oss.sourcemapIndices': apmConfig.sourcemapIndices, - 'apm_oss.onboardingIndices': apmConfig.onboardingIndices, /* eslint-enable @typescript-eslint/naming-convention */ 'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled, 'xpack.apm.serviceMapFingerprintBucketSize': diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts index d1026b0b6ca8b..19d9dd52d5512 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts @@ -99,7 +99,7 @@ export function registerErrorCountAlertType({ }); const searchParams = { - index: indices['apm_oss.errorIndices'], + index: indices['xpack.apm.errorIndices'], size: 0, body: { query: { diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index b383b4777eca4..a0abc63392d8c 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -119,8 +119,8 @@ export function registerTransactionDurationAlertType({ SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices['apm_oss.metricsIndices'] - : indices['apm_oss.transactionIndices']; + ? indices['xpack.apm.metricsIndices'] + : indices['xpack.apm.transactionIndices']; const field = getTransactionDurationFieldForAggregatedTransactions( searchAggregatedTransactions diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts index 6c59bcc4107b0..77c4834443591 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts @@ -114,8 +114,8 @@ export function registerTransactionErrorRateAlertType({ SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices['apm_oss.metricsIndices'] - : indices['apm_oss.transactionIndices']; + ? indices['xpack.apm.metricsIndices'] + : indices['xpack.apm.transactionIndices']; const searchParams = { index, diff --git a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts index 5d5865bdd2289..20d8f8d04301b 100644 --- a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts +++ b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts @@ -18,8 +18,8 @@ export const createRuleTypeMocks = () => { const mockedConfig$ = of({ /* eslint-disable @typescript-eslint/naming-convention */ - 'apm_oss.errorIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', + 'xpack.apm.errorIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', /* eslint-enable @typescript-eslint/naming-convention */ } as APMConfig); diff --git a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts index 324202b207237..9f3b2dd4a9acc 100644 --- a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts +++ b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts @@ -50,7 +50,7 @@ export async function createAnomalyDetectionJobs( `Creating ML anomaly detection jobs for environments: [${uniqueMlJobEnvs}].` ); - const indexPatternName = indices['apm_oss.metricsIndices']; + const indexPatternName = indices['xpack.apm.metricsIndices']; const responses = await Promise.all( uniqueMlJobEnvs.map((environment) => createAnomalyDetectionJob({ ml, environment, indexPatternName }) diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index 446efca5aff82..ebb8ad3386c19 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -19,10 +19,6 @@ describe('data telemetry collection tasks', () => { 'xpack.apm.metricsIndices': 'apm-8.0.0-metric', 'xpack.apm.spanIndices': 'apm-8.0.0-span', 'xpack.apm.transactionIndices': 'apm-8.0.0-transaction', - 'apm_oss.errorIndices': 'apm-8.0.0-error', - 'apm_oss.metricsIndices': 'apm-8.0.0-metric', - 'apm_oss.spanIndices': 'apm-8.0.0-span', - 'apm_oss.transactionIndices': 'apm-8.0.0-transaction', /* eslint-enable @typescript-eslint/naming-convention */ } as ApmIndicesConfig; diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts index d624c8527df86..9720735c3c49c 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts @@ -78,7 +78,7 @@ export const tasks: TelemetryTask[] = [ }; const params = { - index: [indices['apm_oss.transactionIndices']], + index: [indices['xpack.apm.transactionIndices']], body: { size: 0, timeout, @@ -138,7 +138,7 @@ export const tasks: TelemetryTask[] = [ // fixed date range for reliable results const lastTransaction = ( await search({ - index: indices['apm_oss.transactionIndices'], + index: indices['xpack.apm.transactionIndices'], body: { query: { bool: { @@ -253,10 +253,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices['apm_oss.errorIndices'], - indices['apm_oss.metricsIndices'], - indices['apm_oss.spanIndices'], - indices['apm_oss.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.metricsIndices'], + indices['xpack.apm.spanIndices'], + indices['xpack.apm.transactionIndices'], ], body: { size: 0, @@ -310,10 +310,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices['apm_oss.errorIndices'], - indices['apm_oss.metricsIndices'], - indices['apm_oss.spanIndices'], - indices['apm_oss.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.metricsIndices'], + indices['xpack.apm.spanIndices'], + indices['xpack.apm.transactionIndices'], ], body: { size: 0, @@ -345,7 +345,7 @@ export const tasks: TelemetryTask[] = [ name: 'environments', executor: async ({ indices, search }) => { const response = await search({ - index: [indices['apm_oss.transactionIndices']], + index: [indices['xpack.apm.transactionIndices']], body: { query: { bool: { @@ -426,12 +426,12 @@ export const tasks: TelemetryTask[] = [ name: 'processor_events', executor: async ({ indices, search }) => { const indicesByProcessorEvent = { - error: indices['apm_oss.errorIndices'], - metric: indices['apm_oss.metricsIndices'], - span: indices['apm_oss.spanIndices'], - transaction: indices['apm_oss.transactionIndices'], - onboarding: indices['apm_oss.onboardingIndices'], - sourcemap: indices['apm_oss.sourcemapIndices'], + error: indices['xpack.apm.errorIndices'], + metric: indices['xpack.apm.metricsIndices'], + span: indices['xpack.apm.spanIndices'], + transaction: indices['xpack.apm.transactionIndices'], + onboarding: indices['xpack.apm.onboardingIndices'], + sourcemap: indices['xpack.apm.sourcemapIndices'], }; type ProcessorEvent = keyof typeof indicesByProcessorEvent; @@ -549,10 +549,10 @@ export const tasks: TelemetryTask[] = [ return prevJob.then(async (data) => { const response = await search({ index: [ - indices['apm_oss.errorIndices'], - indices['apm_oss.spanIndices'], - indices['apm_oss.metricsIndices'], - indices['apm_oss.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.spanIndices'], + indices['xpack.apm.metricsIndices'], + indices['xpack.apm.transactionIndices'], ], body: { size: 0, @@ -599,9 +599,9 @@ export const tasks: TelemetryTask[] = [ executor: async ({ search, indices }) => { const response = await search({ index: [ - indices['apm_oss.transactionIndices'], - indices['apm_oss.spanIndices'], - indices['apm_oss.errorIndices'], + indices['xpack.apm.transactionIndices'], + indices['xpack.apm.spanIndices'], + indices['xpack.apm.errorIndices'], ], terminateAfter: 1, body: { @@ -647,7 +647,7 @@ export const tasks: TelemetryTask[] = [ executor: async ({ search, indices }) => { const errorGroupsCount = ( await search({ - index: indices['apm_oss.errorIndices'], + index: indices['xpack.apm.errorIndices'], body: { size: 0, timeout, @@ -683,7 +683,7 @@ export const tasks: TelemetryTask[] = [ const transactionGroupsCount = ( await search({ - index: indices['apm_oss.transactionIndices'], + index: indices['xpack.apm.transactionIndices'], body: { size: 0, timeout, @@ -719,7 +719,7 @@ export const tasks: TelemetryTask[] = [ const tracesPerDayCount = ( await search({ - index: indices['apm_oss.transactionIndices'], + index: indices['xpack.apm.transactionIndices'], body: { query: { bool: { @@ -742,9 +742,9 @@ export const tasks: TelemetryTask[] = [ const servicesCount = ( await search({ index: [ - indices['apm_oss.transactionIndices'], - indices['apm_oss.errorIndices'], - indices['apm_oss.metricsIndices'], + indices['xpack.apm.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.metricsIndices'], ], body: { size: 0, @@ -812,9 +812,9 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices['apm_oss.errorIndices'], - indices['apm_oss.metricsIndices'], - indices['apm_oss.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.metricsIndices'], + indices['xpack.apm.transactionIndices'], ], body: { size: 0, @@ -1006,12 +1006,12 @@ export const tasks: TelemetryTask[] = [ const response = await indicesStats({ index: [ indices.apmAgentConfigurationIndex, - indices['apm_oss.errorIndices'], - indices['apm_oss.metricsIndices'], - indices['apm_oss.onboardingIndices'], - indices['apm_oss.sourcemapIndices'], - indices['apm_oss.spanIndices'], - indices['apm_oss.transactionIndices'], + indices['xpack.apm.errorIndices'], + indices['xpack.apm.metricsIndices'], + indices['xpack.apm.onboardingIndices'], + indices['xpack.apm.sourcemapIndices'], + indices['xpack.apm.spanIndices'], + indices['xpack.apm.transactionIndices'], ], }); diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts index deaf792ee2313..7647b9bb1ebf2 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts @@ -50,12 +50,6 @@ describe('get buckets', () => { 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.transactionIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', - 'apm_oss.sourcemapIndices': 'apm-*', - 'apm_oss.errorIndices': 'apm-*', - 'apm_oss.onboardingIndices': 'apm-*', - 'apm_oss.spanIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', - 'apm_oss.metricsIndices': 'apm-*', /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index 91d9f14e8cc07..95d7ad72f1f39 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -25,12 +25,6 @@ describe('unpackProcessorEvents', () => { 'xpack.apm.spanIndices': 'my-apm-*-span-*', 'xpack.apm.onboardingIndices': 'my-apm-*-onboarding-', 'xpack.apm.sourcemapIndices': 'my-apm-*-sourcemap-*', - 'apm_oss.transactionIndices': 'my-apm-*-transaction-*', - 'apm_oss.metricsIndices': 'my-apm-*-metric-*', - 'apm_oss.errorIndices': 'my-apm-*-error-*', - 'apm_oss.spanIndices': 'my-apm-*-span-*', - 'apm_oss.onboardingIndices': 'my-apm-*-onboarding-', - 'apm_oss.sourcemapIndices': 'my-apm-*-sourcemap-*', } as ApmIndicesConfig; res = unpackProcessorEvents(request, indices); diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index 643f84ad1dbfc..af3071df9f63d 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -20,12 +20,6 @@ jest.mock('../settings/apm_indices/get_apm_indices', () => ({ 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.transactionIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', - 'apm_oss.sourcemapIndices': 'apm-*', - 'apm_oss.errorIndices': 'apm-*', - 'apm_oss.onboardingIndices': 'apm-*', - 'apm_oss.spanIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', - 'apm_oss.metricsIndices': 'apm-*', /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'apm-*', }), diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index e8df39aaa7593..4fc7477e0101c 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -29,10 +29,6 @@ const setup = { 'xpack.apm.spanIndices': 'apm-*-span-*', 'xpack.apm.errorIndices': 'apm-*-error-*', 'xpack.apm.metricsIndices': 'apm-*-metrics-*', - 'apm_oss.transactionIndices': 'apm-*-transaction-*', - 'apm_oss.spanIndices': 'apm-*-span-*', - 'apm_oss.errorIndices': 'apm-*-error-*', - 'apm_oss.metricsIndices': 'apm-*-metrics-*', }, } as unknown as Setup; diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts index f7432bede331b..11640493c2e08 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts @@ -17,10 +17,6 @@ describe('getApmIndexPatternTitle', () => { 'xpack.apm.spanIndices': 'apm-*-span-*', 'xpack.apm.errorIndices': 'apm-*-error-*', 'xpack.apm.metricsIndices': 'apm-*-metrics-*', - 'apm_oss.transactionIndices': 'apm-*-transaction-*', - 'apm_oss.spanIndices': 'apm-*-span-*', - 'apm_oss.errorIndices': 'apm-*-error-*', - 'apm_oss.metricsIndices': 'apm-*-metrics-*', } as ApmIndicesConfig); expect(title).toBe( 'apm-*-transaction-*,apm-*-span-*,apm-*-error-*,apm-*-metrics-*' @@ -33,10 +29,6 @@ describe('getApmIndexPatternTitle', () => { 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.errorIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', - 'apm_oss.spanIndices': 'apm-*', - 'apm_oss.errorIndices': 'apm-*', - 'apm_oss.metricsIndices': 'apm-*', } as ApmIndicesConfig); expect(title).toBe('apm-*'); }); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts index e65f200130e9a..ae70e4cf4bbc8 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts @@ -10,9 +10,9 @@ import { ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; export function getApmIndexPatternTitle(apmIndicesConfig: ApmIndicesConfig) { return uniq([ - apmIndicesConfig['apm_oss.transactionIndices'], - apmIndicesConfig['apm_oss.spanIndices'], - apmIndicesConfig['apm_oss.errorIndices'], - apmIndicesConfig['apm_oss.metricsIndices'], + apmIndicesConfig['xpack.apm.transactionIndices'], + apmIndicesConfig['xpack.apm.spanIndices'], + apmIndicesConfig['xpack.apm.errorIndices'], + apmIndicesConfig['xpack.apm.metricsIndices'], ]).join(','); } diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts index ebb5c7655806a..910c86bbabb7b 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts @@ -55,7 +55,7 @@ export async function hasRumData({ const response = await apmEventClient.search('has_rum_data', params); return { - indices: setup.indices['apm_oss.transactionIndices']!, + indices: setup.indices['xpack.apm.transactionIndices']!, hasData: response.hits.total.value > 0, serviceName: response.aggregations?.services?.mostTraffic?.buckets?.[0]?.key, @@ -64,7 +64,7 @@ export async function hasRumData({ return { hasData: false, serviceName: undefined, - indices: setup.indices['apm_oss.transactionIndices']!, + indices: setup.indices['xpack.apm.transactionIndices']!, }; } } diff --git a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts index 02ba0a8514b62..ea9ed01f930ce 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts @@ -65,7 +65,7 @@ export const failedTransactionsCorrelationsSearchServiceProvider: FailedTransact const params: FailedTransactionsCorrelationsRequestParams & SearchStrategyServerParams = { ...searchServiceParams, - index: indices['apm_oss.transactionIndices'], + index: indices['xpack.apm.transactionIndices'], includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts index 7e420c821a746..3e70b4650fd49 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts @@ -67,7 +67,7 @@ export const latencyCorrelationsSearchServiceProvider: LatencyCorrelationsSearch const indices = await getApmIndices(); params = { ...searchServiceParams, - index: indices['apm_oss.transactionIndices'], + index: indices['xpack.apm.transactionIndices'], includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts index 0b203b10f1310..4e3626101cdcb 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts @@ -93,7 +93,6 @@ const getApmIndicesMock = async () => ({ // eslint-disable-next-line @typescript-eslint/naming-convention 'xpack.apm.transactionIndices': 'apm-*', - 'apm_oss.transactionIndices': 'apm-*', } as ApmIndicesConfig); describe('APM Correlations search strategy', () => { diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index fc56223bbf285..d907691828cfe 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -20,8 +20,6 @@ export { ApmIndicesConfig }; type ISavedObjectsClient = Pick; -export type ApmIndicesName = keyof ApmIndicesConfig; - async function getApmIndicesSavedObject( savedObjectsClient: ISavedObjectsClient ) { @@ -43,12 +41,6 @@ export function getApmIndicesConfig(config: APMConfig): ApmIndicesConfig { 'xpack.apm.spanIndices': config['xpack.apm.spanIndices'], 'xpack.apm.transactionIndices': config['xpack.apm.transactionIndices'], 'xpack.apm.metricsIndices': config['xpack.apm.metricsIndices'], - 'apm_oss.sourcemapIndices': config['apm_oss.sourcemapIndices'], - 'apm_oss.errorIndices': config['apm_oss.errorIndices'], - 'apm_oss.onboardingIndices': config['apm_oss.onboardingIndices'], - 'apm_oss.spanIndices': config['apm_oss.spanIndices'], - 'apm_oss.transactionIndices': config['apm_oss.transactionIndices'], - 'apm_oss.metricsIndices': config['apm_oss.metricsIndices'], /* eslint-enable @typescript-eslint/naming-convention */ // system indices, not configurable apmAgentConfigurationIndex: '.apm-agent-configuration', @@ -68,38 +60,19 @@ export async function getApmIndices({ savedObjectsClient ); const apmIndicesConfig = getApmIndicesConfig(config); - return mergeApmIndicesConfigs(apmIndicesConfig, apmIndicesSavedObject); + return { ...apmIndicesConfig, ...apmIndicesSavedObject }; } catch (error) { return getApmIndicesConfig(config); } } -function mergeApmIndicesConfigs( - apmIndicesConfig: ApmIndicesConfig, - apmIndicesSavedObject: PromiseReturnType -) { - return APM_UI_INDICES.reduce( - (mergedConfigs, savedIndexConfig) => { - const savedApmIndex = - apmIndicesSavedObject[savedIndexConfig[0]] || - apmIndicesSavedObject[savedIndexConfig[1]]; // TODO remove deprecated apm_oss support in 8.0 - return { - ...mergedConfigs, - [savedIndexConfig[0]]: savedApmIndex, - [savedIndexConfig[1]]: savedApmIndex, - }; - }, - { ...apmIndicesConfig } - ); -} - -const APM_UI_INDICES: Array<[ApmIndicesName, ApmIndicesName]> = [ - ['xpack.apm.sourcemapIndices', 'apm_oss.sourcemapIndices'], - ['xpack.apm.errorIndices', 'apm_oss.errorIndices'], - ['xpack.apm.onboardingIndices', 'apm_oss.onboardingIndices'], - ['xpack.apm.spanIndices', 'apm_oss.spanIndices'], - ['xpack.apm.transactionIndices', 'apm_oss.transactionIndices'], - ['xpack.apm.metricsIndices', 'apm_oss.metricsIndices'], +const APM_UI_INDICES: Array = [ + 'xpack.apm.sourcemapIndices', + 'xpack.apm.errorIndices', + 'xpack.apm.onboardingIndices', + 'xpack.apm.spanIndices', + 'xpack.apm.transactionIndices', + 'xpack.apm.metricsIndices', ]; export async function getApmIndexSettings({ @@ -120,13 +93,9 @@ export async function getApmIndexSettings({ } const apmIndicesConfig = getApmIndicesConfig(config); - return APM_UI_INDICES.map( - ([configurationName, deprecatedConfigurationName]) => ({ - configurationName, - defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml - savedValue: - apmIndicesSavedObject[configurationName] || - apmIndicesSavedObject[deprecatedConfigurationName], // value saved via Saved Objects service - }) - ); + return APM_UI_INDICES.map((configurationName) => ({ + configurationName, + defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml + savedValue: apmIndicesSavedObject[configurationName], // value saved via Saved Objects service + })); } diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index 7f2a3a4ec7019..6398ec8f8d951 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -20,12 +20,6 @@ const mockIndices = { 'xpack.apm.spanIndices': 'myIndex', 'xpack.apm.transactionIndices': 'myIndex', 'xpack.apm.metricsIndices': 'myIndex', - 'apm_oss.sourcemapIndices': 'myIndex', - 'apm_oss.errorIndices': 'myIndex', - 'apm_oss.onboardingIndices': 'myIndex', - 'apm_oss.spanIndices': 'myIndex', - 'apm_oss.transactionIndices': 'myIndex', - 'apm_oss.metricsIndices': 'myIndex', /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index 872ab0afeb689..5e0d4bac9557a 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -52,13 +52,6 @@ const saveApmIndicesRoute = createApmServerRoute({ 'xpack.apm.spanIndices': t.string, 'xpack.apm.transactionIndices': t.string, 'xpack.apm.metricsIndices': t.string, - 'apm_oss.sourcemapIndices': t.string, - 'apm_oss.errorIndices': t.string, - 'apm_oss.onboardingIndices': t.string, - 'apm_oss.spanIndices': t.string, - 'apm_oss.transactionIndices': t.string, - 'apm_oss.metricsIndices': t.string, - /* eslint-enable @typescript-eslint/naming-convention */ }), }), handler: async (resources) => { diff --git a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index fb9fbae33ac82..2fc9d5d6cb2e2 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -39,10 +39,10 @@ export function onPremInstructions({ }: { apmConfig: Pick< APMConfig, - | 'apm_oss.errorIndices' - | 'apm_oss.transactionIndices' - | 'apm_oss.metricsIndices' - | 'apm_oss.onboardingIndices' + | 'xpack.apm.errorIndices' + | 'xpack.apm.transactionIndices' + | 'xpack.apm.metricsIndices' + | 'xpack.apm.onboardingIndices' >; isFleetPluginEnabled: boolean; }): InstructionsSchema { @@ -144,7 +144,7 @@ export function onPremInstructions({ } ), esHitsCheck: { - index: apmConfig['apm_oss.onboardingIndices'], + index: apmConfig['xpack.apm.onboardingIndices'], query: { bool: { filter: [ @@ -237,9 +237,9 @@ export function onPremInstructions({ ), esHitsCheck: { index: [ - apmConfig['apm_oss.errorIndices'], - apmConfig['apm_oss.transactionIndices'], - apmConfig['apm_oss.metricsIndices'], + apmConfig['xpack.apm.errorIndices'], + apmConfig['xpack.apm.transactionIndices'], + apmConfig['xpack.apm.metricsIndices'], ], query: { bool: { diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 3fc11b40bc1a5..4818800a771fe 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -34,12 +34,6 @@ interface MockSetup { 'xpack.apm.spanIndices': string; 'xpack.apm.transactionIndices': string; 'xpack.apm.metricsIndices': string; - 'apm_oss.sourcemapIndices': string; - 'apm_oss.errorIndices': string; - 'apm_oss.onboardingIndices': string; - 'apm_oss.spanIndices': string; - 'apm_oss.transactionIndices': string; - 'apm_oss.metricsIndices': string; /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; @@ -98,12 +92,6 @@ export async function inspectSearchParams( 'xpack.apm.spanIndices': 'myIndex', 'xpack.apm.transactionIndices': 'myIndex', 'xpack.apm.metricsIndices': 'myIndex', - 'apm_oss.sourcemapIndices': 'myIndex', - 'apm_oss.errorIndices': 'myIndex', - 'apm_oss.onboardingIndices': 'myIndex', - 'apm_oss.spanIndices': 'myIndex', - 'apm_oss.transactionIndices': 'myIndex', - 'apm_oss.metricsIndices': 'myIndex', /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index d2178f2c455ed..839989f970589 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -24,14 +24,6 @@ export interface ApmIndicesConfig { 'xpack.apm.transactionIndices': string; 'xpack.apm.metricsIndices': string; - // includes deprecated indices from apm_oss path - 'apm_oss.sourcemapIndices': string; - 'apm_oss.errorIndices': string; - 'apm_oss.onboardingIndices': string; - 'apm_oss.spanIndices': string; - 'apm_oss.transactionIndices': string; - 'apm_oss.metricsIndices': string; - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx index 88818665bbe2a..a9ac124809d30 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -65,7 +65,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { case 'mobile': const resultApm = await getDataHandler('apm')?.hasData(); hasDataT = Boolean(resultApm?.hasData); - indices = resultApm?.indices['apm_oss.transactionIndices']; + indices = resultApm?.indices['xpack.apm.transactionIndices']; break; } setHasAppData((prevState) => ({ ...prevState, [dataType]: hasDataT })); diff --git a/x-pack/plugins/observability/public/context/has_data_context.test.tsx b/x-pack/plugins/observability/public/context/has_data_context.test.tsx index 36f7bfb990222..cd9c4692ca5eb 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.test.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.test.tsx @@ -26,7 +26,7 @@ const relativeEnd = '2020-10-08T07:00:00.000Z'; const sampleAPMIndices = { // eslint-disable-next-line @typescript-eslint/naming-convention - 'apm_oss.transactionIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', } as ApmIndicesConfig; function wrapper({ children }: { children: React.ReactElement }) { diff --git a/x-pack/plugins/observability/public/data_handler.test.ts b/x-pack/plugins/observability/public/data_handler.test.ts index e0b8494d4dbed..889ea5bd23775 100644 --- a/x-pack/plugins/observability/public/data_handler.test.ts +++ b/x-pack/plugins/observability/public/data_handler.test.ts @@ -11,7 +11,7 @@ import { ApmIndicesConfig } from '../common/typings'; const sampleAPMIndices = { // eslint-disable-next-line @typescript-eslint/naming-convention - 'apm_oss.transactionIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', } as ApmIndicesConfig; const params = { diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 3c389a0ee20b2..75576d4a70e8e 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -38,7 +38,7 @@ function unregisterAll() { const sampleAPMIndices = { // eslint-disable-next-line @typescript-eslint/naming-convention - 'apm_oss.transactionIndices': 'apm-*', + 'xpack.apm.transactionIndices': 'apm-*', } as ApmIndicesConfig; const withCore = makeDecorator({ diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json index a083c8f7e3bcf..f1dfc542dad5c 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json @@ -189,25 +189,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json index 22b79eb9bbd8e..fae1a1379f5ad 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json @@ -216,25 +216,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json index 74083cbfa949a..b430bf962fb4a 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json @@ -214,25 +214,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } From 3f99b3b20c971e12a94439763ac8625f4d0b8703 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Mon, 4 Oct 2021 14:51:52 -0400 Subject: [PATCH 06/17] fixes missing bundle error --- packages/kbn-optimizer/limits.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 8fb31b36f39d5..056518af19bdd 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -2,7 +2,6 @@ pageLoadAssetSize: advancedSettings: 27596 alerting: 106936 apm: 64385 - apmOss: 18996 bfetch: 51874 canvas: 1066647 charts: 95000 From e962bfff9ef0d543ac85a0c472ebb4a215ebe32f Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Mon, 4 Oct 2021 15:14:41 -0400 Subject: [PATCH 07/17] fixes type error --- .../create_apm_event_client/unpack_processor_events.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index c823d5b77ad64..04a22a6ca7643 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -13,19 +13,16 @@ import { ESFilter, } from '../../../../../../../../src/core/types/elasticsearch'; import { APMEventESSearchRequest, APMEventESTermsEnumRequest } from '.'; -import { - ApmIndicesConfig, - ApmIndicesName, -} from '../../../settings/apm_indices/get_apm_indices'; +import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; -const processorEventIndexMap: Record = { +const processorEventIndexMap = { [ProcessorEvent.transaction]: 'xpack.apm.transactionIndices', [ProcessorEvent.span]: 'xpack.apm.spanIndices', [ProcessorEvent.metric]: 'xpack.apm.metricsIndices', [ProcessorEvent.error]: 'xpack.apm.errorIndices', // TODO: should have its own config setting [ProcessorEvent.profile]: 'xpack.apm.transactionIndices', -}; +} as const; export function unpackProcessorEvents( request: APMEventESSearchRequest | APMEventESTermsEnumRequest, From ed2a1001177d6c18e97c0ff65e00138ef14cbc25 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Mon, 4 Oct 2021 15:31:58 -0400 Subject: [PATCH 08/17] fixes eslint error with disabled rules --- .../ftr_e2e/cypress/integration/power_user/no_data_screen.ts | 1 - x-pack/plugins/apm/public/utils/testHelpers.tsx | 4 ---- x-pack/plugins/apm/scripts/shared/read-kibana-config.ts | 2 -- x-pack/plugins/apm/server/index.test.ts | 2 -- x-pack/plugins/apm/server/index.ts | 2 -- x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts | 2 -- .../lib/apm_telemetry/collect_data_telemetry/tasks.test.ts | 2 -- .../apm/server/lib/errors/distribution/get_buckets.test.ts | 2 -- .../create_apm_event_client/unpack_processor_events.test.ts | 1 - x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts | 2 -- .../lib/index_pattern/create_static_index_pattern.test.ts | 1 - .../lib/index_pattern/get_apm_index_pattern_title.test.ts | 2 -- .../lib/search_strategies/search_strategy_provider.test.ts | 5 +---- .../apm/server/lib/settings/apm_indices/get_apm_indices.ts | 2 -- .../apm/server/lib/transactions/breakdown/index.test.ts | 2 -- x-pack/plugins/apm/server/routes/settings/apm_indices.ts | 1 - x-pack/plugins/apm/server/saved_objects/apm_indices.ts | 1 - x-pack/plugins/apm/server/utils/test_helpers.tsx | 2 -- x-pack/plugins/observability/common/typings.ts | 3 --- .../observability/public/context/has_data_context.test.tsx | 5 +---- x-pack/plugins/observability/public/data_handler.test.ts | 5 +---- .../observability/public/pages/overview/overview.stories.tsx | 5 +---- 22 files changed, 4 insertions(+), 50 deletions(-) diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts index 9e8af6f39f659..bdc7edbafe8f3 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -/* eslint-disable @typescript-eslint/naming-convention */ const apmIndicesSaveURL = '/api/apm/settings/apm-indices/save'; diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx index b8b80370bddaa..e777317e220a3 100644 --- a/x-pack/plugins/apm/public/utils/testHelpers.tsx +++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx @@ -119,14 +119,12 @@ interface MockSetup { config: APMConfig; uiFilters: UxUIFilters; indices: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': string; 'xpack.apm.errorIndices': string; 'xpack.apm.onboardingIndices': string; 'xpack.apm.spanIndices': string; 'xpack.apm.transactionIndices': string; 'xpack.apm.metricsIndices': string; - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; }; @@ -178,14 +176,12 @@ export async function inspectSearchParams( ) as APMConfig, uiFilters: {}, indices: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': 'myIndex', 'xpack.apm.errorIndices': 'myIndex', 'xpack.apm.onboardingIndices': 'myIndex', 'xpack.apm.spanIndices': 'myIndex', 'xpack.apm.transactionIndices': 'myIndex', 'xpack.apm.metricsIndices': 'myIndex', - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }, diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index 668fb29c13543..5b1fdc0ad4732 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -38,14 +38,12 @@ export const readKibanaConfig = () => { }; return { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.transactionIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', 'xpack.apm.errorIndices': 'apm-*', 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.onboardingIndices': 'apm-*', 'xpack.apm.sourcemapIndices': 'apm-*', - /* eslint-enable @typescript-eslint/naming-convention */ 'elasticsearch.hosts': 'http://localhost:9200', ...loadedKibanaConfig, ...cliEsCredentials, diff --git a/x-pack/plugins/apm/server/index.test.ts b/x-pack/plugins/apm/server/index.test.ts index bb105bdfe6532..88a5aa196ea3c 100644 --- a/x-pack/plugins/apm/server/index.test.ts +++ b/x-pack/plugins/apm/server/index.test.ts @@ -5,8 +5,6 @@ * 2.0. */ -/* eslint-disable @typescript-eslint/naming-convention */ - import { APMXPackConfig } from '.'; import { mergeConfigs } from './index'; diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index e9e8b9965f36b..99b81cb781c06 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -106,14 +106,12 @@ export type APMConfig = ReturnType; // plugin config and ui indices settings export function mergeConfigs(apmConfig: APMXPackConfig) { const mergedConfig = { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.transactionIndices': apmConfig.transactionIndices, 'xpack.apm.spanIndices': apmConfig.spanIndices, 'xpack.apm.errorIndices': apmConfig.errorIndices, 'xpack.apm.metricsIndices': apmConfig.metricsIndices, 'xpack.apm.sourcemapIndices': apmConfig.sourcemapIndices, 'xpack.apm.onboardingIndices': apmConfig.onboardingIndices, - /* eslint-enable @typescript-eslint/naming-convention */ 'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled, 'xpack.apm.serviceMapFingerprintBucketSize': apmConfig.serviceMapFingerprintBucketSize, diff --git a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts index 20d8f8d04301b..f51ad03e60bf4 100644 --- a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts +++ b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts @@ -17,10 +17,8 @@ export const createRuleTypeMocks = () => { let alertExecutor: (...args: any[]) => Promise; const mockedConfig$ = of({ - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.errorIndices': 'apm-*', 'xpack.apm.transactionIndices': 'apm-*', - /* eslint-enable @typescript-eslint/naming-convention */ } as APMConfig); const loggerMock = { diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index ebb8ad3386c19..e126068ed12e5 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -14,12 +14,10 @@ import { describe('data telemetry collection tasks', () => { const indices = { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.errorIndices': 'apm-8.0.0-error', 'xpack.apm.metricsIndices': 'apm-8.0.0-metric', 'xpack.apm.spanIndices': 'apm-8.0.0-span', 'xpack.apm.transactionIndices': 'apm-8.0.0-transaction', - /* eslint-enable @typescript-eslint/naming-convention */ } as ApmIndicesConfig; describe('environments', () => { diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts index 7647b9bb1ebf2..e2afdb31795eb 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts @@ -43,14 +43,12 @@ describe('get buckets', () => { } ) as APMConfig, indices: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': 'apm-*', 'xpack.apm.errorIndices': 'apm-*', 'xpack.apm.onboardingIndices': 'apm-*', 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.transactionIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', }, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index 95d7ad72f1f39..cc454cc0f291d 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -5,7 +5,6 @@ * 2.0. */ -/* eslint-disable @typescript-eslint/naming-convention */ import { APMEventESSearchRequest } from '.'; import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; import { unpackProcessorEvents } from './unpack_processor_events'; diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index af3071df9f63d..d2740712d3ccc 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -13,14 +13,12 @@ import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames'; jest.mock('../settings/apm_indices/get_apm_indices', () => ({ getApmIndices: async () => ({ - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': 'apm-*', 'xpack.apm.errorIndices': 'apm-*', 'xpack.apm.onboardingIndices': 'apm-*', 'xpack.apm.spanIndices': 'apm-*', 'xpack.apm.transactionIndices': 'apm-*', 'xpack.apm.metricsIndices': 'apm-*', - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'apm-*', }), })); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index 4fc7477e0101c..0e5c6548ecc14 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -5,7 +5,6 @@ * 2.0. */ -/* eslint-disable @typescript-eslint/naming-convention */ import { createStaticIndexPattern } from './create_static_index_pattern'; import { Setup } from '../helpers/setup_request'; import * as HistoricalAgentData from '../../routes/historical_data/has_historical_agent_data'; diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts index 11640493c2e08..92f325c80a184 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts @@ -5,8 +5,6 @@ * 2.0. */ -/* eslint-disable @typescript-eslint/naming-convention */ - import { ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; import { getApmIndexPatternTitle } from './get_apm_index_pattern_title'; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts index 4e3626101cdcb..be70dd7cf632b 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts @@ -90,10 +90,7 @@ const clientSearchMock = ( }; const getApmIndicesMock = async () => - ({ - // eslint-disable-next-line @typescript-eslint/naming-convention - 'xpack.apm.transactionIndices': 'apm-*', - } as ApmIndicesConfig); + ({ 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig); describe('APM Correlations search strategy', () => { describe('strategy interface', () => { diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index d907691828cfe..125814d58e734 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -34,14 +34,12 @@ async function getApmIndicesSavedObject( export function getApmIndicesConfig(config: APMConfig): ApmIndicesConfig { return { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': config['xpack.apm.sourcemapIndices'], 'xpack.apm.errorIndices': config['xpack.apm.errorIndices'], 'xpack.apm.onboardingIndices': config['xpack.apm.onboardingIndices'], 'xpack.apm.spanIndices': config['xpack.apm.spanIndices'], 'xpack.apm.transactionIndices': config['xpack.apm.transactionIndices'], 'xpack.apm.metricsIndices': config['xpack.apm.metricsIndices'], - /* eslint-enable @typescript-eslint/naming-convention */ // system indices, not configurable apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index 6398ec8f8d951..ab75ec7f36126 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -13,14 +13,12 @@ import { APMConfig } from '../../..'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; const mockIndices = { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': 'myIndex', 'xpack.apm.errorIndices': 'myIndex', 'xpack.apm.onboardingIndices': 'myIndex', 'xpack.apm.spanIndices': 'myIndex', 'xpack.apm.transactionIndices': 'myIndex', 'xpack.apm.metricsIndices': 'myIndex', - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }; diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index 5e0d4bac9557a..ef85b6ee4fb8b 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -45,7 +45,6 @@ const saveApmIndicesRoute = createApmServerRoute({ }, params: t.type({ body: t.partial({ - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': t.string, 'xpack.apm.errorIndices': t.string, 'xpack.apm.onboardingIndices': t.string, diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts index ff7453a4b965e..2d855cb515e17 100644 --- a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts +++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts @@ -15,7 +15,6 @@ export const apmIndices: SavedObjectsType = { namespaceType: 'agnostic', mappings: { properties: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': { type: 'keyword', }, diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 4818800a771fe..6f6c0e41c4df1 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -27,14 +27,12 @@ interface MockSetup { config: APMConfig; uiFilters: UxUIFilters; indices: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': string; 'xpack.apm.errorIndices': string; 'xpack.apm.onboardingIndices': string; 'xpack.apm.spanIndices': string; 'xpack.apm.transactionIndices': string; 'xpack.apm.metricsIndices': string; - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; }; diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index 839989f970589..657841e59ff0a 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -16,15 +16,12 @@ export const alertWorkflowStatusRt = t.keyof({ export type AlertWorkflowStatus = t.TypeOf; export interface ApmIndicesConfig { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': string; 'xpack.apm.errorIndices': string; 'xpack.apm.onboardingIndices': string; 'xpack.apm.spanIndices': string; 'xpack.apm.transactionIndices': string; 'xpack.apm.metricsIndices': string; - - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; } diff --git a/x-pack/plugins/observability/public/context/has_data_context.test.tsx b/x-pack/plugins/observability/public/context/has_data_context.test.tsx index cd9c4692ca5eb..dc227936aeafc 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.test.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.test.tsx @@ -24,10 +24,7 @@ import { act } from '@testing-library/react'; const relativeStart = '2020-10-08T06:00:00.000Z'; const relativeEnd = '2020-10-08T07:00:00.000Z'; -const sampleAPMIndices = { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'xpack.apm.transactionIndices': 'apm-*', -} as ApmIndicesConfig; +const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; function wrapper({ children }: { children: React.ReactElement }) { const history = createMemoryHistory(); diff --git a/x-pack/plugins/observability/public/data_handler.test.ts b/x-pack/plugins/observability/public/data_handler.test.ts index 889ea5bd23775..441de2e44af1d 100644 --- a/x-pack/plugins/observability/public/data_handler.test.ts +++ b/x-pack/plugins/observability/public/data_handler.test.ts @@ -9,10 +9,7 @@ import { registerDataHandler, getDataHandler } from './data_handler'; import moment from 'moment'; import { ApmIndicesConfig } from '../common/typings'; -const sampleAPMIndices = { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'xpack.apm.transactionIndices': 'apm-*', -} as ApmIndicesConfig; +const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; const params = { absoluteTime: { diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 75576d4a70e8e..8bac62402d538 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -36,10 +36,7 @@ function unregisterAll() { unregisterDataHandler({ appName: 'synthetics' }); } -const sampleAPMIndices = { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'xpack.apm.transactionIndices': 'apm-*', -} as ApmIndicesConfig; +const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; const withCore = makeDecorator({ name: 'withCore', From 96ca96b957b13480b8a975825838997c3f30d9b9 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Mon, 4 Oct 2021 16:03:39 -0400 Subject: [PATCH 09/17] fixes saved object mappings for es_archvices for tests --- .../action_task_params/mappings.json | 40 ++++++++++-------- .../es_archives/actions/mappings.json | 40 ++++++++++-------- .../es_archives/alerts_legacy/mappings.json | 40 ++++++++++-------- .../es_archives/canvas/reports/mappings.json | 40 ++++++++++-------- .../cases/migrations/7.10.0/mappings.json | 40 ++++++++++-------- .../cases/migrations/7.11.1/mappings.json | 42 ++++++++++--------- .../cases/migrations/7.13.2/mappings.json | 42 ++++++++++--------- .../7.13_user_actions/mappings.json | 42 ++++++++++--------- .../data/search_sessions/mappings.json | 40 ++++++++++-------- .../telemetry/agent_only/mappings.json | 40 ++++++++++-------- .../mappings.json | 40 ++++++++++-------- .../cloned_endpoint_installed/mappings.json | 40 ++++++++++-------- .../cloned_endpoint_uninstalled/mappings.json | 40 ++++++++++-------- .../endpoint_malware_disabled/mappings.json | 40 ++++++++++-------- .../endpoint_malware_enabled/mappings.json | 40 ++++++++++-------- .../endpoint_uninstalled/mappings.json | 40 ++++++++++-------- .../es_archives/fleet/agents/mappings.json | 40 ++++++++++-------- .../mappings.json | 40 ++++++++++-------- .../es_archives/lists/mappings.json | 40 ++++++++++-------- .../canvas_disallowed_url/mappings.json | 40 ++++++++++-------- .../ecommerce_kibana_spaces/mappings.json | 40 ++++++++++-------- .../reporting/hugedata/mappings.json | 40 ++++++++++-------- .../multi_index_kibana/mappings.json | 42 ++++++++++--------- .../timelines/7.15.0/mappings.json | 40 ++++++++++-------- .../visualize/default/mappings.json | 40 ++++++++++-------- 25 files changed, 554 insertions(+), 454 deletions(-) diff --git a/x-pack/test/functional/es_archives/action_task_params/mappings.json b/x-pack/test/functional/es_archives/action_task_params/mappings.json index 2bb6be179d890..ab08540a145b0 100644 --- a/x-pack/test/functional/es_archives/action_task_params/mappings.json +++ b/x-pack/test/functional/es_archives/action_task_params/mappings.json @@ -206,25 +206,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/actions/mappings.json b/x-pack/test/functional/es_archives/actions/mappings.json index eeb9d09d3b0a2..6351edc05d02c 100644 --- a/x-pack/test/functional/es_archives/actions/mappings.json +++ b/x-pack/test/functional/es_archives/actions/mappings.json @@ -202,25 +202,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/alerts_legacy/mappings.json b/x-pack/test/functional/es_archives/alerts_legacy/mappings.json index 69edf30c1ffd0..6e7361ead2601 100644 --- a/x-pack/test/functional/es_archives/alerts_legacy/mappings.json +++ b/x-pack/test/functional/es_archives/alerts_legacy/mappings.json @@ -198,25 +198,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/canvas/reports/mappings.json b/x-pack/test/functional/es_archives/canvas/reports/mappings.json index 047a52aaa1f98..68f34d37dbd3d 100644 --- a/x-pack/test/functional/es_archives/canvas/reports/mappings.json +++ b/x-pack/test/functional/es_archives/canvas/reports/mappings.json @@ -229,25 +229,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json index c7e1a180e6c54..62049be7d9dcc 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json @@ -199,25 +199,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json index bc719ab40aebd..de4e11dee2f25 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json @@ -254,25 +254,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } @@ -2720,4 +2724,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json index 88f3e5d78cb16..cf82159d06b48 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json @@ -260,25 +260,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } @@ -2864,4 +2868,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json index c6b71a2613859..cf2442c59c6b0 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json @@ -261,25 +261,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } @@ -2951,4 +2955,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/data/search_sessions/mappings.json b/x-pack/test/functional/es_archives/data/search_sessions/mappings.json index a3eab7787c3eb..f61db73871acd 100644 --- a/x-pack/test/functional/es_archives/data/search_sessions/mappings.json +++ b/x-pack/test/functional/es_archives/data/search_sessions/mappings.json @@ -169,25 +169,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json index 4dcb8f905b197..08a9d3b8f893e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json @@ -198,25 +198,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json index d6d91281151aa..4e6ebd37527aa 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json @@ -199,25 +199,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json index d6d91281151aa..4e6ebd37527aa 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json @@ -199,25 +199,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json index d6d91281151aa..4e6ebd37527aa 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json @@ -199,25 +199,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json index 4dcb8f905b197..08a9d3b8f893e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json @@ -198,25 +198,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json index 4dcb8f905b197..08a9d3b8f893e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json @@ -198,25 +198,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json index 4dcb8f905b197..08a9d3b8f893e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json @@ -198,25 +198,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/fleet/agents/mappings.json b/x-pack/test/functional/es_archives/fleet/agents/mappings.json index 8e4c7a912b75a..e294fe5bc8845 100644 --- a/x-pack/test/functional/es_archives/fleet/agents/mappings.json +++ b/x-pack/test/functional/es_archives/fleet/agents/mappings.json @@ -189,25 +189,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json b/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json index 7479c525f6a07..d8aa7f2a5fc68 100644 --- a/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json +++ b/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json @@ -181,25 +181,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/lists/mappings.json b/x-pack/test/functional/es_archives/lists/mappings.json index 134ed28bac2e7..f33d0a9ee6b17 100644 --- a/x-pack/test/functional/es_archives/lists/mappings.json +++ b/x-pack/test/functional/es_archives/lists/mappings.json @@ -196,25 +196,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json b/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json index 5bffb9540e983..a6df85c97779c 100644 --- a/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json @@ -193,25 +193,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json b/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json index 254184cbef584..295236e90c181 100644 --- a/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json @@ -214,25 +214,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json b/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json index 1fdde9d9d208b..143547d17d214 100644 --- a/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json @@ -170,25 +170,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json b/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json index f950877aea332..74a554910da33 100644 --- a/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json @@ -172,25 +172,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } @@ -2028,4 +2032,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json index 7561dbb8dc6d2..cf32d22feb11f 100644 --- a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json +++ b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json @@ -276,25 +276,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } diff --git a/x-pack/test/functional/es_archives/visualize/default/mappings.json b/x-pack/test/functional/es_archives/visualize/default/mappings.json index 00dddbcafdd1c..62b3f9105e2c2 100644 --- a/x-pack/test/functional/es_archives/visualize/default/mappings.json +++ b/x-pack/test/functional/es_archives/visualize/default/mappings.json @@ -254,25 +254,29 @@ }, "apm-indices": { "properties": { - "apm_oss": { + "xpack": { "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" + "apm": { + "properties": { + "errorIndices": { + "type": "keyword" + }, + "metricsIndices": { + "type": "keyword" + }, + "onboardingIndices": { + "type": "keyword" + }, + "sourcemapIndices": { + "type": "keyword" + }, + "spanIndices": { + "type": "keyword" + }, + "transactionIndices": { + "type": "keyword" + } + } } } } From 2f0ac0b20162678bd99e7d53a8d04ea6adeaf10c Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Tue, 5 Oct 2021 09:35:34 -0400 Subject: [PATCH 10/17] fixes eslint error --- x-pack/plugins/apm/server/utils/test_helpers.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 6f6c0e41c4df1..10b6695005733 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -83,14 +83,12 @@ export async function inspectSearchParams( ) as APMConfig, uiFilters: options?.uiFilters ?? {}, indices: { - /* eslint-disable @typescript-eslint/naming-convention */ 'xpack.apm.sourcemapIndices': 'myIndex', 'xpack.apm.errorIndices': 'myIndex', 'xpack.apm.onboardingIndices': 'myIndex', 'xpack.apm.spanIndices': 'myIndex', 'xpack.apm.transactionIndices': 'myIndex', 'xpack.apm.metricsIndices': 'myIndex', - /* eslint-enable @typescript-eslint/naming-convention */ apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }, From 66953afe17004fa4239a70f8471b7e1785f8b1f3 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Thu, 7 Oct 2021 02:03:42 -0400 Subject: [PATCH 11/17] Updates default index values to include the more general apm-*. Fixes broken tests. --- x-pack/plugins/apm/server/index.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 99b81cb781c06..abc99b2461156 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -46,16 +46,12 @@ const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: false }), }), }), - transactionIndices: schema.string({ - defaultValue: 'traces-apm*,apm-*-transaction-*', - }), - spanIndices: schema.string({ defaultValue: 'traces-apm*,apm-*-span-*' }), - errorIndices: schema.string({ defaultValue: 'logs-apm*,apm-*-error-*' }), - metricsIndices: schema.string({ - defaultValue: 'metrics-apm*,apm-*-metric-*', - }), - sourcemapIndices: schema.string({ defaultValue: 'apm-*-sourcemap-*' }), - onboardingIndices: schema.string({ defaultValue: 'apm-*-onboarding-*' }), + transactionIndices: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + spanIndices: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + errorIndices: schema.string({ defaultValue: 'logs-apm*,apm-*' }), + metricsIndices: schema.string({ defaultValue: 'metrics-apm*,apm-*' }), + sourcemapIndices: schema.string({ defaultValue: 'apm-*' }), + onboardingIndices: schema.string({ defaultValue: 'apm-*' }), indexPattern: schema.string({ defaultValue: 'apm-*' }), fleetMode: schema.boolean({ defaultValue: true }), }); From 0122390a5d770de3e269a12c602f416ec48ac45b Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Thu, 7 Oct 2021 08:43:07 -0400 Subject: [PATCH 12/17] removing unused configs from the config path migration: apm_oss.indexPattern and apm_oss.fleetMode --- x-pack/plugins/apm/server/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index abc99b2461156..92b4e0bd88399 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -74,8 +74,6 @@ export const config: PluginConfigDescriptor = { renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.metricsIndices'), renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.sourcemapIndices'), renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.onboardingIndices'), - renameFromRoot('apm_oss.indexPattern', 'xpack.apm.indexPattern'), - renameFromRoot('apm_oss.fleetMode', 'xpack.apm.fleetMode'), deprecateFromRoot('apm_oss.enabled', '8.0.0'), unusedFromRoot('apm_oss.fleetMode'), unusedFromRoot('apm_oss.indexPattern'), From 72c4e18057b3fc3f3e8a11e2a1271286b76d27ce Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Tue, 12 Oct 2021 00:07:08 -0400 Subject: [PATCH 13/17] - replaces full index configuration paths with references in the `xpack.apm.indices` namespace - removes mergeConfig function and test --- .../resources/base/bin/kibana-docker | 6 ++ .../integration/power_user/no_data_screen.ts | 24 +++--- .../app/Settings/ApmIndices/index.tsx | 17 ++-- .../plugins/apm/public/utils/testHelpers.tsx | 24 +++--- .../apm/scripts/shared/read-kibana-config.ts | 12 +-- .../scripts/upload-telemetry-data/index.ts | 7 +- x-pack/plugins/apm/server/index.test.ts | 34 -------- x-pack/plugins/apm/server/index.ts | 69 ++++------------ .../alerts/register_error_count_alert_type.ts | 2 +- ...egister_transaction_duration_alert_type.ts | 6 +- ...ister_transaction_error_rate_alert_type.ts | 6 +- .../apm/server/lib/alerts/test_utils/index.ts | 6 +- .../create_anomaly_detection_jobs.ts | 2 +- .../collect_data_telemetry/tasks.test.ts | 8 +- .../collect_data_telemetry/tasks.ts | 78 ++++++++----------- .../errors/distribution/get_buckets.test.ts | 12 +-- .../get_is_using_transaction_events.test.ts | 9 +-- .../get_is_using_transaction_events.ts | 3 +- .../helpers/aggregated_transactions/index.ts | 3 +- .../unpack_processor_events.test.ts | 12 +-- .../unpack_processor_events.ts | 10 +-- .../server/lib/helpers/setup_request.test.ts | 12 +-- .../create_static_index_pattern.test.ts | 22 +++--- .../create_static_index_pattern.ts | 2 +- .../get_apm_index_pattern_title.test.ts | 16 ++-- .../get_apm_index_pattern_title.ts | 8 +- .../java/gc/fetch_and_transform_gc_metrics.ts | 2 +- .../metrics/fetch_and_transform_metrics.ts | 2 +- .../apm/server/lib/rum_client/has_rum_data.ts | 4 +- ...ransactions_correlations_search_service.ts | 2 +- .../latency_correlations_search_service.ts | 2 +- .../search_strategy_provider.test.ts | 2 +- .../server/lib/service_map/get_service_map.ts | 5 +- .../get_service_map_service_node_info.test.ts | 4 +- .../lib/service_map/get_trace_sample_ids.ts | 13 ++-- .../get_service_transaction_groups.ts | 2 +- .../settings/apm_indices/get_apm_indices.ts | 29 +++---- .../apm/server/lib/traces/get_trace_items.ts | 8 +- .../lib/transactions/breakdown/index.test.ts | 12 +-- .../lib/transactions/breakdown/index.ts | 2 +- x-pack/plugins/apm/server/plugin.ts | 34 ++++---- x-pack/plugins/apm/server/routes/fleet.ts | 6 +- .../plugins/apm/server/routes/service_map.ts | 6 +- .../apm/server/routes/settings/apm_indices.ts | 12 +-- .../apm/server/saved_objects/apm_indices.ts | 24 ++---- .../migrations/update_apm_oss_index_paths.ts | 39 +++++----- .../apm/server/tutorial/envs/on_prem.ts | 16 ++-- x-pack/plugins/apm/server/tutorial/index.ts | 2 +- .../plugins/apm/server/utils/test_helpers.tsx | 29 +++---- .../plugins/observability/common/typings.ts | 12 +-- .../hooks/use_app_index_pattern.tsx | 2 +- .../public/context/has_data_context.test.tsx | 2 +- .../observability/public/data_handler.test.ts | 2 +- .../pages/overview/overview.stories.tsx | 2 +- .../encrypted_saved_objects/mappings.json | 42 ++++------ .../mappings.json | 42 ++++------ .../es_archiver/key_rotation/mappings.json | 42 ++++------ .../action_task_params/mappings.json | 42 ++++------ .../es_archives/actions/mappings.json | 42 ++++------ .../es_archives/alerts_legacy/mappings.json | 42 ++++------ .../es_archives/canvas/reports/mappings.json | 42 ++++------ .../cases/migrations/7.10.0/mappings.json | 42 ++++------ .../cases/migrations/7.11.1/mappings.json | 42 ++++------ .../cases/migrations/7.13.2/mappings.json | 42 ++++------ .../7.13_user_actions/mappings.json | 42 ++++------ .../migrations/7.16.0_space/mappings.json | 38 ++++----- .../data/search_sessions/mappings.json | 42 ++++------ .../telemetry/agent_only/mappings.json | 42 ++++------ .../mappings.json | 42 ++++------ .../cloned_endpoint_installed/mappings.json | 42 ++++------ .../cloned_endpoint_uninstalled/mappings.json | 42 ++++------ .../endpoint_malware_disabled/mappings.json | 42 ++++------ .../endpoint_malware_enabled/mappings.json | 42 ++++------ .../endpoint_uninstalled/mappings.json | 42 ++++------ .../es_archives/fleet/agents/mappings.json | 42 ++++------ .../mappings.json | 42 ++++------ .../es_archives/lists/mappings.json | 42 ++++------ .../canvas_disallowed_url/mappings.json | 42 ++++------ .../ecommerce_kibana_spaces/mappings.json | 42 ++++------ .../reporting/hugedata/mappings.json | 42 ++++------ .../multi_index_kibana/mappings.json | 42 ++++------ .../migrations/mappings.json | 38 ++++----- .../timelines/7.15.0/mappings.json | 42 ++++------ .../timelines/7.15.0_space/mappings.json | 40 +++++----- .../visualize/default/mappings.json | 42 ++++------ 85 files changed, 816 insertions(+), 1163 deletions(-) delete mode 100644 x-pack/plugins/apm/server/index.test.ts diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index f87d1c9664273..680aef242eb85 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -212,6 +212,12 @@ kibana_vars=( xpack.alerts.invalidateApiKeysTask.interval xpack.alerts.invalidateApiKeysTask.removalDelay xpack.apm.enabled + xpack.apm.errors + xpack.apm.metrics + xpack.apm.onboarding + xpack.apm.sourcemaps + xpack.apm.spans + xpack.apm.transactions xpack.apm.maxServiceEnvironments xpack.apm.searchAggregatedTransactions xpack.apm.serviceMapEnabled diff --git a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts index bdc7edbafe8f3..718b8bfb0175e 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress/integration/power_user/no_data_screen.ts @@ -19,12 +19,12 @@ describe('No data screen', () => { url: apmIndicesSaveURL, method: 'POST', body: { - 'xpack.apm.sourcemapIndices': 'foo-*', - 'xpack.apm.errorIndices': 'foo-*', - 'xpack.apm.onboardingIndices': 'foo-*', - 'xpack.apm.spanIndices': 'foo-*', - 'xpack.apm.transactionIndices': 'foo-*', - 'xpack.apm.metricsIndices': 'foo-*', + sourcemaps: 'foo-*', + errors: 'foo-*', + onboarding: 'foo-*', + spans: 'foo-*', + transactions: 'foo-*', + metrics: 'foo-*', }, headers: { 'kbn-xsrf': true, @@ -49,12 +49,12 @@ describe('No data screen', () => { url: apmIndicesSaveURL, method: 'POST', body: { - 'xpack.apm.sourcemapIndices': '', - 'xpack.apm.errorIndices': '', - 'xpack.apm.onboardingIndices': '', - 'xpack.apm.spanIndices': '', - 'xpack.apm.transactionIndices': '', - 'xpack.apm.metricsIndices': '', + sourcemaps: '', + errors: '', + onboarding: '', + spans: '', + transactions: '', + metrics: '', }, headers: { 'kbn-xsrf': true }, auth: { user: 'apm_power_user', pass: 'changeme' }, diff --git a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx index dd7c491598f14..595d34a2588bf 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx @@ -30,40 +30,40 @@ import { const APM_INDEX_LABELS = [ { - configurationName: 'xpack.apm.sourcemapIndices', + configurationName: 'sourcemaps', label: i18n.translate( 'xpack.apm.settings.apmIndices.sourcemapIndicesLabel', { defaultMessage: 'Sourcemap Indices' } ), }, { - configurationName: 'xpack.apm.errorIndices', + configurationName: 'errors', label: i18n.translate('xpack.apm.settings.apmIndices.errorIndicesLabel', { defaultMessage: 'Error Indices', }), }, { - configurationName: 'xpack.apm.onboardingIndices', + configurationName: 'onboarding', label: i18n.translate( 'xpack.apm.settings.apmIndices.onboardingIndicesLabel', { defaultMessage: 'Onboarding Indices' } ), }, { - configurationName: 'xpack.apm.spanIndices', + configurationName: 'spans', label: i18n.translate('xpack.apm.settings.apmIndices.spanIndicesLabel', { defaultMessage: 'Span Indices', }), }, { - configurationName: 'xpack.apm.transactionIndices', + configurationName: 'transactions', label: i18n.translate( 'xpack.apm.settings.apmIndices.transactionIndicesLabel', { defaultMessage: 'Transaction Indices' } ), }, { - configurationName: 'xpack.apm.metricsIndices', + configurationName: 'metrics', label: i18n.translate('xpack.apm.settings.apmIndices.metricsIndicesLabel', { defaultMessage: 'Metrics Indices', }), @@ -214,7 +214,10 @@ export function ApmIndices() { { defaultMessage: 'Overrides {configurationName}: {defaultValue}', - values: { configurationName, defaultValue }, + values: { + configurationName: `xpack.apm.indices.${configurationName}`, + defaultValue, + }, } )} fullWidth diff --git a/x-pack/plugins/apm/public/utils/testHelpers.tsx b/x-pack/plugins/apm/public/utils/testHelpers.tsx index e777317e220a3..2203bc63f68cd 100644 --- a/x-pack/plugins/apm/public/utils/testHelpers.tsx +++ b/x-pack/plugins/apm/public/utils/testHelpers.tsx @@ -119,12 +119,12 @@ interface MockSetup { config: APMConfig; uiFilters: UxUIFilters; indices: { - 'xpack.apm.sourcemapIndices': string; - 'xpack.apm.errorIndices': string; - 'xpack.apm.onboardingIndices': string; - 'xpack.apm.spanIndices': string; - 'xpack.apm.transactionIndices': string; - 'xpack.apm.metricsIndices': string; + sourcemaps: string; + errors: string; + onboarding: string; + spans: string; + transactions: string; + metrics: string; apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; }; @@ -176,12 +176,12 @@ export async function inspectSearchParams( ) as APMConfig, uiFilters: {}, indices: { - 'xpack.apm.sourcemapIndices': 'myIndex', - 'xpack.apm.errorIndices': 'myIndex', - 'xpack.apm.onboardingIndices': 'myIndex', - 'xpack.apm.spanIndices': 'myIndex', - 'xpack.apm.transactionIndices': 'myIndex', - 'xpack.apm.metricsIndices': 'myIndex', + sourcemaps: 'myIndex', + errors: 'myIndex', + onboarding: 'myIndex', + spans: 'myIndex', + transactions: 'myIndex', + metrics: 'myIndex', apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }, diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index 5b1fdc0ad4732..dbdb2278b15a0 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -38,12 +38,12 @@ export const readKibanaConfig = () => { }; return { - 'xpack.apm.transactionIndices': 'apm-*', - 'xpack.apm.metricsIndices': 'apm-*', - 'xpack.apm.errorIndices': 'apm-*', - 'xpack.apm.spanIndices': 'apm-*', - 'xpack.apm.onboardingIndices': 'apm-*', - 'xpack.apm.sourcemapIndices': 'apm-*', + 'xpack.apm.indices.transactions': 'apm-*', + 'xpack.apm.indices.metrics': 'apm-*', + 'xpack.apm.indices.errors': 'apm-*', + 'xpack.apm.indices.spans': 'apm-*', + 'xpack.apm.indices.onboarding': 'apm-*', + 'xpack.apm.indices.sourcemaps': 'apm-*', 'elasticsearch.hosts': 'http://localhost:9200', ...loadedKibanaConfig, ...cliEsCredentials, diff --git a/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts index 0dab75cfba9c7..5e5053521db6f 100644 --- a/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts +++ b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts @@ -78,7 +78,12 @@ async function uploadData() { collectTelemetryParams: { logger: console as unknown as Logger, indices: { - ...config, + transactions: config['xpack.apm.indices.transactions'], + metrics: config['xpack.apm.indices.metrics'], + errors: config['xpack.apm.indices.errors'], + spans: config['xpack.apm.indices.spans'], + onboarding: config['xpack.apm.indices.onboarding'], + sourcemaps: config['xpack.apm.indices.sourcemaps'], apmCustomLinkIndex: '.apm-custom-links', apmAgentConfigurationIndex: '.apm-agent-configuration', }, diff --git a/x-pack/plugins/apm/server/index.test.ts b/x-pack/plugins/apm/server/index.test.ts deleted file mode 100644 index 88a5aa196ea3c..0000000000000 --- a/x-pack/plugins/apm/server/index.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { APMXPackConfig } from '.'; -import { mergeConfigs } from './index'; - -describe('mergeConfigs', () => { - it('merges the configs', () => { - const apmConfig = { - transactionIndices: 'traces-apm*,apm-*-transaction-*', - spanIndices: 'traces-apm*,apm-*-span-*', - errorIndices: 'logs-apm*,apm-*-error-*', - metricsIndices: 'metrics-apm*,apm-*-metric-*', - ui: { enabled: false }, - enabled: true, - metricsInterval: 2000, - agent: { migrations: { enabled: true } }, - } as APMXPackConfig; - - expect(mergeConfigs(apmConfig)).toEqual({ - 'xpack.apm.errorIndices': 'logs-apm*,apm-*-error-*', - 'xpack.apm.metricsIndices': 'metrics-apm*,apm-*-metric-*', - 'xpack.apm.spanIndices': 'traces-apm*,apm-*-span-*', - 'xpack.apm.transactionIndices': 'traces-apm*,apm-*-transaction-*', - 'xpack.apm.metricsInterval': 2000, - 'xpack.apm.ui.enabled': false, - 'xpack.apm.agent.migrations.enabled': true, - }); - }); -}); diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 92b4e0bd88399..f5f41754c435e 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -46,18 +46,18 @@ const configSchema = schema.object({ enabled: schema.boolean({ defaultValue: false }), }), }), - transactionIndices: schema.string({ defaultValue: 'traces-apm*,apm-*' }), - spanIndices: schema.string({ defaultValue: 'traces-apm*,apm-*' }), - errorIndices: schema.string({ defaultValue: 'logs-apm*,apm-*' }), - metricsIndices: schema.string({ defaultValue: 'metrics-apm*,apm-*' }), - sourcemapIndices: schema.string({ defaultValue: 'apm-*' }), - onboardingIndices: schema.string({ defaultValue: 'apm-*' }), - indexPattern: schema.string({ defaultValue: 'apm-*' }), - fleetMode: schema.boolean({ defaultValue: true }), + indices: schema.object({ + transactions: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + spans: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + errors: schema.string({ defaultValue: 'logs-apm*,apm-*' }), + metrics: schema.string({ defaultValue: 'metrics-apm*,apm-*' }), + sourcemaps: schema.string({ defaultValue: 'apm-*' }), + onboarding: schema.string({ defaultValue: 'apm-*' }), + }), }); // plugin config -export const config: PluginConfigDescriptor = { +export const config: PluginConfigDescriptor = { deprecations: ({ deprecate, renameFromRoot, @@ -67,13 +67,13 @@ export const config: PluginConfigDescriptor = { deprecate('enabled', '8.0.0'), renameFromRoot( 'apm_oss.transactionIndices', - 'xpack.apm.transactionIndices' + 'xpack.apm.indices.transactions' ), - renameFromRoot('apm_oss.spanIndices', 'xpack.apm.spanIndices'), - renameFromRoot('apm_oss.errorIndices', 'xpack.apm.errorIndices'), - renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.metricsIndices'), - renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.sourcemapIndices'), - renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.onboardingIndices'), + renameFromRoot('apm_oss.spanIndices', 'xpack.apm.indices.spans'), + renameFromRoot('apm_oss.errorIndices', 'xpack.apm.indices.errors'), + renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.indices.metrics'), + renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.indices.sourcemaps'), + renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.indices.onboarding'), deprecateFromRoot('apm_oss.enabled', '8.0.0'), unusedFromRoot('apm_oss.fleetMode'), unusedFromRoot('apm_oss.indexPattern'), @@ -94,44 +94,7 @@ export const config: PluginConfigDescriptor = { schema: configSchema, }; -export type APMXPackConfig = TypeOf; -export type APMConfig = ReturnType; - -// plugin config and ui indices settings -export function mergeConfigs(apmConfig: APMXPackConfig) { - const mergedConfig = { - 'xpack.apm.transactionIndices': apmConfig.transactionIndices, - 'xpack.apm.spanIndices': apmConfig.spanIndices, - 'xpack.apm.errorIndices': apmConfig.errorIndices, - 'xpack.apm.metricsIndices': apmConfig.metricsIndices, - 'xpack.apm.sourcemapIndices': apmConfig.sourcemapIndices, - 'xpack.apm.onboardingIndices': apmConfig.onboardingIndices, - 'xpack.apm.serviceMapEnabled': apmConfig.serviceMapEnabled, - 'xpack.apm.serviceMapFingerprintBucketSize': - apmConfig.serviceMapFingerprintBucketSize, - 'xpack.apm.serviceMapTraceIdBucketSize': - apmConfig.serviceMapTraceIdBucketSize, - 'xpack.apm.serviceMapFingerprintGlobalBucketSize': - apmConfig.serviceMapFingerprintGlobalBucketSize, - 'xpack.apm.serviceMapTraceIdGlobalBucketSize': - apmConfig.serviceMapTraceIdGlobalBucketSize, - 'xpack.apm.serviceMapMaxTracesPerRequest': - apmConfig.serviceMapMaxTracesPerRequest, - 'xpack.apm.ui.enabled': apmConfig.ui.enabled, - 'xpack.apm.ui.maxTraceItems': apmConfig.ui.maxTraceItems, - 'xpack.apm.ui.transactionGroupBucketSize': - apmConfig.ui.transactionGroupBucketSize, - 'xpack.apm.autocreateApmIndexPattern': apmConfig.autocreateApmIndexPattern, - 'xpack.apm.telemetryCollectionEnabled': - apmConfig.telemetryCollectionEnabled, - 'xpack.apm.searchAggregatedTransactions': - apmConfig.searchAggregatedTransactions, - 'xpack.apm.metricsInterval': apmConfig.metricsInterval, - 'xpack.apm.agent.migrations.enabled': apmConfig.agent.migrations.enabled, - }; - - return mergedConfig; -} +export type APMConfig = TypeOf; export const plugin = (initContext: PluginInitializerContext) => new APMPlugin(initContext); diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts index 19d9dd52d5512..e87cb0c8cb9e1 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts @@ -99,7 +99,7 @@ export function registerErrorCountAlertType({ }); const searchParams = { - index: indices['xpack.apm.errorIndices'], + index: indices.errors, size: 0, body: { query: { diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index a0abc63392d8c..82df85a0f516d 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -115,12 +115,12 @@ export function registerTransactionDurationAlertType({ // to prevent (likely) unnecessary blocking request // in rule execution const searchAggregatedTransactions = - config['xpack.apm.searchAggregatedTransactions'] !== + config.searchAggregatedTransactions !== SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices['xpack.apm.metricsIndices'] - : indices['xpack.apm.transactionIndices']; + ? indices.metrics + : indices.transactions; const field = getTransactionDurationFieldForAggregatedTransactions( searchAggregatedTransactions diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts index 77c4834443591..758066e305a61 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts @@ -110,12 +110,12 @@ export function registerTransactionErrorRateAlertType({ // to prevent (likely) unnecessary blocking request // in rule execution const searchAggregatedTransactions = - config['xpack.apm.searchAggregatedTransactions'] !== + config.searchAggregatedTransactions !== SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices['xpack.apm.metricsIndices'] - : indices['xpack.apm.transactionIndices']; + ? indices.metrics + : indices.transactions; const searchParams = { index, diff --git a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts index f51ad03e60bf4..68bd113c52cb3 100644 --- a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts +++ b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts @@ -17,8 +17,10 @@ export const createRuleTypeMocks = () => { let alertExecutor: (...args: any[]) => Promise; const mockedConfig$ = of({ - 'xpack.apm.errorIndices': 'apm-*', - 'xpack.apm.transactionIndices': 'apm-*', + indices: { + errors: 'apm-*', + transactions: 'apm-*', + }, } as APMConfig); const loggerMock = { diff --git a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts index 9f3b2dd4a9acc..63f78b0be9d27 100644 --- a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts +++ b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts @@ -50,7 +50,7 @@ export async function createAnomalyDetectionJobs( `Creating ML anomaly detection jobs for environments: [${uniqueMlJobEnvs}].` ); - const indexPatternName = indices['xpack.apm.metricsIndices']; + const indexPatternName = indices.metrics; const responses = await Promise.all( uniqueMlJobEnvs.map((environment) => createAnomalyDetectionJob({ ml, environment, indexPatternName }) diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index e126068ed12e5..3fe7b698f34cc 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -14,10 +14,10 @@ import { describe('data telemetry collection tasks', () => { const indices = { - 'xpack.apm.errorIndices': 'apm-8.0.0-error', - 'xpack.apm.metricsIndices': 'apm-8.0.0-metric', - 'xpack.apm.spanIndices': 'apm-8.0.0-span', - 'xpack.apm.transactionIndices': 'apm-8.0.0-transaction', + errors: 'apm-8.0.0-error', + metrics: 'apm-8.0.0-metric', + spans: 'apm-8.0.0-span', + transactions: 'apm-8.0.0-transaction', } as ApmIndicesConfig; describe('environments', () => { diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts index 9720735c3c49c..07a95a9089612 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts @@ -78,7 +78,7 @@ export const tasks: TelemetryTask[] = [ }; const params = { - index: [indices['xpack.apm.transactionIndices']], + index: [indices.transactions], body: { size: 0, timeout, @@ -138,7 +138,7 @@ export const tasks: TelemetryTask[] = [ // fixed date range for reliable results const lastTransaction = ( await search({ - index: indices['xpack.apm.transactionIndices'], + index: indices.transactions, body: { query: { bool: { @@ -253,10 +253,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices['xpack.apm.errorIndices'], - indices['xpack.apm.metricsIndices'], - indices['xpack.apm.spanIndices'], - indices['xpack.apm.transactionIndices'], + indices.errors, + indices.metrics, + indices.spans, + indices.transactions, ], body: { size: 0, @@ -310,10 +310,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices['xpack.apm.errorIndices'], - indices['xpack.apm.metricsIndices'], - indices['xpack.apm.spanIndices'], - indices['xpack.apm.transactionIndices'], + indices.errors, + indices.metrics, + indices.spans, + indices.transactions, ], body: { size: 0, @@ -345,7 +345,7 @@ export const tasks: TelemetryTask[] = [ name: 'environments', executor: async ({ indices, search }) => { const response = await search({ - index: [indices['xpack.apm.transactionIndices']], + index: [indices.transactions], body: { query: { bool: { @@ -426,12 +426,12 @@ export const tasks: TelemetryTask[] = [ name: 'processor_events', executor: async ({ indices, search }) => { const indicesByProcessorEvent = { - error: indices['xpack.apm.errorIndices'], - metric: indices['xpack.apm.metricsIndices'], - span: indices['xpack.apm.spanIndices'], - transaction: indices['xpack.apm.transactionIndices'], - onboarding: indices['xpack.apm.onboardingIndices'], - sourcemap: indices['xpack.apm.sourcemapIndices'], + error: indices.errors, + metric: indices.metrics, + span: indices.spans, + transaction: indices.transactions, + onboarding: indices.onboarding, + sourcemap: indices.sourcemaps, }; type ProcessorEvent = keyof typeof indicesByProcessorEvent; @@ -549,10 +549,10 @@ export const tasks: TelemetryTask[] = [ return prevJob.then(async (data) => { const response = await search({ index: [ - indices['xpack.apm.errorIndices'], - indices['xpack.apm.spanIndices'], - indices['xpack.apm.metricsIndices'], - indices['xpack.apm.transactionIndices'], + indices.errors, + indices.spans, + indices.metrics, + indices.transactions, ], body: { size: 0, @@ -598,11 +598,7 @@ export const tasks: TelemetryTask[] = [ name: 'versions', executor: async ({ search, indices }) => { const response = await search({ - index: [ - indices['xpack.apm.transactionIndices'], - indices['xpack.apm.spanIndices'], - indices['xpack.apm.errorIndices'], - ], + index: [indices.transactions, indices.spans, indices.errors], terminateAfter: 1, body: { query: { @@ -647,7 +643,7 @@ export const tasks: TelemetryTask[] = [ executor: async ({ search, indices }) => { const errorGroupsCount = ( await search({ - index: indices['xpack.apm.errorIndices'], + index: indices.errors, body: { size: 0, timeout, @@ -683,7 +679,7 @@ export const tasks: TelemetryTask[] = [ const transactionGroupsCount = ( await search({ - index: indices['xpack.apm.transactionIndices'], + index: indices.transactions, body: { size: 0, timeout, @@ -719,7 +715,7 @@ export const tasks: TelemetryTask[] = [ const tracesPerDayCount = ( await search({ - index: indices['xpack.apm.transactionIndices'], + index: indices.transactions, body: { query: { bool: { @@ -741,11 +737,7 @@ export const tasks: TelemetryTask[] = [ const servicesCount = ( await search({ - index: [ - indices['xpack.apm.transactionIndices'], - indices['xpack.apm.errorIndices'], - indices['xpack.apm.metricsIndices'], - ], + index: [indices.transactions, indices.errors, indices.metrics], body: { size: 0, timeout, @@ -811,11 +803,7 @@ export const tasks: TelemetryTask[] = [ const data = await prevJob; const response = await search({ - index: [ - indices['xpack.apm.errorIndices'], - indices['xpack.apm.metricsIndices'], - indices['xpack.apm.transactionIndices'], - ], + index: [indices.errors, indices.metrics, indices.transactions], body: { size: 0, timeout, @@ -1006,12 +994,12 @@ export const tasks: TelemetryTask[] = [ const response = await indicesStats({ index: [ indices.apmAgentConfigurationIndex, - indices['xpack.apm.errorIndices'], - indices['xpack.apm.metricsIndices'], - indices['xpack.apm.onboardingIndices'], - indices['xpack.apm.sourcemapIndices'], - indices['xpack.apm.spanIndices'], - indices['xpack.apm.transactionIndices'], + indices.errors, + indices.metrics, + indices.onboarding, + indices.sourcemaps, + indices.spans, + indices.transactions, ], }); diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts index e2afdb31795eb..942dd75482dbf 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts @@ -43,12 +43,12 @@ describe('get buckets', () => { } ) as APMConfig, indices: { - 'xpack.apm.sourcemapIndices': 'apm-*', - 'xpack.apm.errorIndices': 'apm-*', - 'xpack.apm.onboardingIndices': 'apm-*', - 'xpack.apm.spanIndices': 'apm-*', - 'xpack.apm.transactionIndices': 'apm-*', - 'xpack.apm.metricsIndices': 'apm-*', + sourcemaps: 'apm-*', + errors: 'apm-*', + onboarding: 'apm-*', + spans: 'apm-*', + transactions: 'apm-*', + metrics: 'apm-*', apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', }, diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts index f17224384842d..1fac873ced7be 100644 --- a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.test.ts @@ -58,8 +58,7 @@ describe('getIsUsingTransactionEvents', () => { describe('with config xpack.apm.searchAggregatedTransactions: never', () => { const config = { - 'xpack.apm.searchAggregatedTransactions': - SearchAggregatedTransactionSetting.never, + searchAggregatedTransactions: SearchAggregatedTransactionSetting.never, }; it('should be false', async () => { @@ -81,8 +80,7 @@ describe('getIsUsingTransactionEvents', () => { describe('with config xpack.apm.searchAggregatedTransactions: always', () => { const config = { - 'xpack.apm.searchAggregatedTransactions': - SearchAggregatedTransactionSetting.always, + searchAggregatedTransactions: SearchAggregatedTransactionSetting.always, }; it('should be false when kuery is empty', async () => { mock = await inspectSearchParams( @@ -164,8 +162,7 @@ describe('getIsUsingTransactionEvents', () => { describe('with config xpack.apm.searchAggregatedTransactions: auto', () => { const config = { - 'xpack.apm.searchAggregatedTransactions': - SearchAggregatedTransactionSetting.auto, + searchAggregatedTransactions: SearchAggregatedTransactionSetting.auto, }; it('should query for data once if metrics data found', async () => { diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts index 70df0959a63b6..66e9697ab7c91 100644 --- a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/get_is_using_transaction_events.ts @@ -23,8 +23,7 @@ export async function getIsUsingTransactionEvents({ start?: number; end?: number; }): Promise { - const searchAggregatedTransactions = - config['xpack.apm.searchAggregatedTransactions']; + const searchAggregatedTransactions = config.searchAggregatedTransactions; if ( searchAggregatedTransactions === SearchAggregatedTransactionSetting.never diff --git a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts index 478f3218ef38c..a58a95dd43fcc 100644 --- a/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts +++ b/x-pack/plugins/apm/server/lib/helpers/aggregated_transactions/index.ts @@ -63,8 +63,7 @@ export async function getSearchAggregatedTransactions({ apmEventClient: APMEventClient; kuery: string; }): Promise { - const searchAggregatedTransactions = - config['xpack.apm.searchAggregatedTransactions']; + const searchAggregatedTransactions = config.searchAggregatedTransactions; if ( kuery || diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index cc454cc0f291d..00321c727ffb3 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -18,12 +18,12 @@ describe('unpackProcessorEvents', () => { } as APMEventESSearchRequest; const indices = { - 'xpack.apm.transactionIndices': 'my-apm-*-transaction-*', - 'xpack.apm.metricsIndices': 'my-apm-*-metric-*', - 'xpack.apm.errorIndices': 'my-apm-*-error-*', - 'xpack.apm.spanIndices': 'my-apm-*-span-*', - 'xpack.apm.onboardingIndices': 'my-apm-*-onboarding-', - 'xpack.apm.sourcemapIndices': 'my-apm-*-sourcemap-*', + transactions: 'my-apm-*-transaction-*', + metrics: 'my-apm-*-metric-*', + errors: 'my-apm-*-error-*', + spans: 'my-apm-*-span-*', + onboarding: 'my-apm-*-onboarding-*', + sourcemaps: 'my-apm-*-sourcemap-*', } as ApmIndicesConfig; res = unpackProcessorEvents(request, indices); diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 04a22a6ca7643..5d9f38f7dd8d4 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -16,12 +16,12 @@ import { APMEventESSearchRequest, APMEventESTermsEnumRequest } from '.'; import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; const processorEventIndexMap = { - [ProcessorEvent.transaction]: 'xpack.apm.transactionIndices', - [ProcessorEvent.span]: 'xpack.apm.spanIndices', - [ProcessorEvent.metric]: 'xpack.apm.metricsIndices', - [ProcessorEvent.error]: 'xpack.apm.errorIndices', + [ProcessorEvent.transaction]: 'transactions', + [ProcessorEvent.span]: 'spans', + [ProcessorEvent.metric]: 'metrics', + [ProcessorEvent.error]: 'errors', // TODO: should have its own config setting - [ProcessorEvent.profile]: 'xpack.apm.transactionIndices', + [ProcessorEvent.profile]: 'transactions', } as const; export function unpackProcessorEvents( diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index d2740712d3ccc..2fa4f58b8a441 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -13,12 +13,12 @@ import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames'; jest.mock('../settings/apm_indices/get_apm_indices', () => ({ getApmIndices: async () => ({ - 'xpack.apm.sourcemapIndices': 'apm-*', - 'xpack.apm.errorIndices': 'apm-*', - 'xpack.apm.onboardingIndices': 'apm-*', - 'xpack.apm.spanIndices': 'apm-*', - 'xpack.apm.transactionIndices': 'apm-*', - 'xpack.apm.metricsIndices': 'apm-*', + sourcemaps: 'apm-*', + errors: 'apm-*', + onboarding: 'apm-*', + spans: 'apm-*', + transactions: 'apm-*', + metrics: 'apm-*', apmAgentConfigurationIndex: 'apm-*', }), })); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index 0e5c6548ecc14..9def9f12568d2 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -24,10 +24,10 @@ function getMockSavedObjectsClient(existingIndexPatternTitle: string) { const setup = { indices: { - 'xpack.apm.transactionIndices': 'apm-*-transaction-*', - 'xpack.apm.spanIndices': 'apm-*-span-*', - 'xpack.apm.errorIndices': 'apm-*-error-*', - 'xpack.apm.metricsIndices': 'apm-*-metrics-*', + transactions: 'apm-*-transaction-*', + spans: 'apm-*-span-*', + errors: 'apm-*-error-*', + metrics: 'apm-*-metrics-*', }, } as unknown as Setup; @@ -36,7 +36,7 @@ describe('createStaticIndexPattern', () => { const savedObjectsClient = getMockSavedObjectsClient('apm-*'); await createStaticIndexPattern({ setup, - config: { 'xpack.apm.autocreateApmIndexPattern': false } as APMConfig, + config: { autocreateApmIndexPattern: false } as APMConfig, savedObjectsClient, spaceId: 'default', }); @@ -53,7 +53,7 @@ describe('createStaticIndexPattern', () => { await createStaticIndexPattern({ setup, - config: { 'xpack.apm.autocreateApmIndexPattern': true } as APMConfig, + config: { autocreateApmIndexPattern: true } as APMConfig, savedObjectsClient, spaceId: 'default', }); @@ -70,7 +70,7 @@ describe('createStaticIndexPattern', () => { await createStaticIndexPattern({ setup, - config: { 'xpack.apm.autocreateApmIndexPattern': true } as APMConfig, + config: { autocreateApmIndexPattern: true } as APMConfig, savedObjectsClient, spaceId: 'default', }); @@ -90,9 +90,7 @@ describe('createStaticIndexPattern', () => { await createStaticIndexPattern({ setup, - config: { - 'xpack.apm.autocreateApmIndexPattern': true, - } as APMConfig, + config: { autocreateApmIndexPattern: true } as APMConfig, savedObjectsClient, spaceId: 'default', }); @@ -119,9 +117,7 @@ describe('createStaticIndexPattern', () => { await createStaticIndexPattern({ setup, - config: { - 'xpack.apm.autocreateApmIndexPattern': true, - } as APMConfig, + config: { autocreateApmIndexPattern: true } as APMConfig, savedObjectsClient, spaceId: 'default', }); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts index 4f35e7e639151..26ae2ac337e88 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.ts @@ -34,7 +34,7 @@ export async function createStaticIndexPattern({ }): Promise { return withApmSpan('create_static_index_pattern', async () => { // don't autocreate APM index pattern if it's been disabled via the config - if (!config['xpack.apm.autocreateApmIndexPattern']) { + if (!config.autocreateApmIndexPattern) { return false; } diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts index 92f325c80a184..f98eed5c5e305 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts @@ -11,10 +11,10 @@ import { getApmIndexPatternTitle } from './get_apm_index_pattern_title'; describe('getApmIndexPatternTitle', () => { it('returns an index pattern title by combining existing indicies', () => { const title = getApmIndexPatternTitle({ - 'xpack.apm.transactionIndices': 'apm-*-transaction-*', - 'xpack.apm.spanIndices': 'apm-*-span-*', - 'xpack.apm.errorIndices': 'apm-*-error-*', - 'xpack.apm.metricsIndices': 'apm-*-metrics-*', + transactions: 'apm-*-transaction-*', + spans: 'apm-*-span-*', + errors: 'apm-*-error-*', + metrics: 'apm-*-metrics-*', } as ApmIndicesConfig); expect(title).toBe( 'apm-*-transaction-*,apm-*-span-*,apm-*-error-*,apm-*-metrics-*' @@ -23,10 +23,10 @@ describe('getApmIndexPatternTitle', () => { it('removes duplicates', () => { const title = getApmIndexPatternTitle({ - 'xpack.apm.transactionIndices': 'apm-*', - 'xpack.apm.spanIndices': 'apm-*', - 'xpack.apm.errorIndices': 'apm-*', - 'xpack.apm.metricsIndices': 'apm-*', + transactions: 'apm-*', + spans: 'apm-*', + errors: 'apm-*', + metrics: 'apm-*', } as ApmIndicesConfig); expect(title).toBe('apm-*'); }); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts index ae70e4cf4bbc8..df67930f56419 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts @@ -10,9 +10,9 @@ import { ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; export function getApmIndexPatternTitle(apmIndicesConfig: ApmIndicesConfig) { return uniq([ - apmIndicesConfig['xpack.apm.transactionIndices'], - apmIndicesConfig['xpack.apm.spanIndices'], - apmIndicesConfig['xpack.apm.errorIndices'], - apmIndicesConfig['xpack.apm.metricsIndices'], + apmIndicesConfig.transactions, + apmIndicesConfig.spans, + apmIndicesConfig.errors, + apmIndicesConfig.metrics, ]).join(','); } diff --git a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts index 8231e4d3c6faa..68ce8de5cd3d9 100644 --- a/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts +++ b/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts @@ -85,7 +85,7 @@ export async function fetchAndTransformGcMetrics({ date_histogram: getMetricsDateHistogramParams({ start, end, - metricsInterval: config['xpack.apm.metricsInterval'], + metricsInterval: config.metricsInterval, }), aggs: { // get the max value diff --git a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts index a3fce0368f4a5..581a0782e4d72 100644 --- a/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts +++ b/x-pack/plugins/apm/server/lib/metrics/fetch_and_transform_metrics.ts @@ -99,7 +99,7 @@ export async function fetchAndTransformMetrics({ date_histogram: getMetricsDateHistogramParams({ start, end, - metricsInterval: config['xpack.apm.metricsInterval'], + metricsInterval: config.metricsInterval, }), aggs, }, diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts index 2cf3bf5fd031d..092eddaedf123 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts @@ -56,7 +56,7 @@ export async function hasRumData({ const response = await apmEventClient.search('has_rum_data', params); return { - indices: setup.indices['xpack.apm.transactionIndices']!, + indices: setup.indices.transactions, hasData: response.hits.total.value > 0, serviceName: response.aggregations?.services?.mostTraffic?.buckets?.[0]?.key, @@ -65,7 +65,7 @@ export async function hasRumData({ return { hasData: false, serviceName: undefined, - indices: setup.indices['xpack.apm.transactionIndices']!, + indices: setup.indices.transactions, }; } } diff --git a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts index ea9ed01f930ce..876d3c14eea04 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts @@ -65,7 +65,7 @@ export const failedTransactionsCorrelationsSearchServiceProvider: FailedTransact const params: FailedTransactionsCorrelationsRequestParams & SearchStrategyServerParams = { ...searchServiceParams, - index: indices['xpack.apm.transactionIndices'], + index: indices.transactions, includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts index 3e70b4650fd49..f7d0e6dca0e2a 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts @@ -67,7 +67,7 @@ export const latencyCorrelationsSearchServiceProvider: LatencyCorrelationsSearch const indices = await getApmIndices(); params = { ...searchServiceParams, - index: indices['xpack.apm.transactionIndices'], + index: indices.transactions, includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts index be70dd7cf632b..b2bea57a913cc 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts @@ -90,7 +90,7 @@ const clientSearchMock = ( }; const getApmIndicesMock = async () => - ({ 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig); + ({ transactions: 'apm-*' } as ApmIndicesConfig); describe('APM Correlations search strategy', () => { describe('strategy interface', () => { diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts index 2497a85c0c774..ae511d0fed8f8 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map.ts @@ -53,10 +53,7 @@ async function getConnectionData({ end, }); - const chunks = chunk( - traceIds, - setup.config['xpack.apm.serviceMapMaxTracesPerRequest'] - ); + const chunks = chunk(traceIds, setup.config.serviceMapMaxTracesPerRequest); const init = { connections: [], diff --git a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts index 2129606e69fc3..afb88189a5fd2 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_service_map_service_node_info.test.ts @@ -70,9 +70,7 @@ describe('getServiceMapServiceNodeInfo', () => { indices: {}, start: 1593460053026000, end: 1593497863217000, - config: { - 'xpack.apm.metricsInterval': 30, - }, + config: { metricsInterval: 30 }, uiFilters: { environment: 'test environment' }, } as unknown as Setup; const serviceName = 'test service name'; diff --git a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts index c1c11f7bf639a..7e16e69498e7c 100644 --- a/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts +++ b/x-pack/plugins/apm/server/lib/service_map/get_trace_sample_ids.ts @@ -60,13 +60,11 @@ export async function getTraceSampleIds({ query.bool.filter.push(...environmentQuery(environment)); const fingerprintBucketSize = serviceName - ? config['xpack.apm.serviceMapFingerprintBucketSize'] - : config['xpack.apm.serviceMapFingerprintGlobalBucketSize']; - + ? config.serviceMapFingerprintBucketSize + : config.serviceMapFingerprintGlobalBucketSize; const traceIdBucketSize = serviceName - ? config['xpack.apm.serviceMapTraceIdBucketSize'] - : config['xpack.apm.serviceMapTraceIdGlobalBucketSize']; - + ? config.serviceMapTraceIdBucketSize + : config.serviceMapTraceIdGlobalBucketSize; const samplerShardSize = traceIdBucketSize * 10; const params = { @@ -137,8 +135,7 @@ export async function getTraceSampleIds({ 'get_trace_sample_ids', params ); - // make sure at least one trace per composite/connection bucket - // is queried + // make sure at least one trace per composite/connection bucket is queried const traceIdsWithPriority = tracesSampleResponse.aggregations?.connections.buckets.flatMap((bucket) => bucket.sample.trace_ids.buckets.map((sampleDocBucket, index) => ({ diff --git a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts index d5a2006060395..fbc1e2880495b 100644 --- a/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts +++ b/x-pack/plugins/apm/server/lib/services/get_service_transaction_groups.ts @@ -57,7 +57,7 @@ export async function getServiceTransactionGroups({ end: number; }) { const { apmEventClient, config } = setup; - const bucketSize = config['xpack.apm.ui.transactionGroupBucketSize']; + const bucketSize = config.ui.transactionGroupBucketSize; const field = getTransactionDurationFieldForAggregatedTransactions( searchAggregatedTransactions diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index 125814d58e734..342d49a85d81b 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -34,12 +34,12 @@ async function getApmIndicesSavedObject( export function getApmIndicesConfig(config: APMConfig): ApmIndicesConfig { return { - 'xpack.apm.sourcemapIndices': config['xpack.apm.sourcemapIndices'], - 'xpack.apm.errorIndices': config['xpack.apm.errorIndices'], - 'xpack.apm.onboardingIndices': config['xpack.apm.onboardingIndices'], - 'xpack.apm.spanIndices': config['xpack.apm.spanIndices'], - 'xpack.apm.transactionIndices': config['xpack.apm.transactionIndices'], - 'xpack.apm.metricsIndices': config['xpack.apm.metricsIndices'], + sourcemaps: config.indices.sourcemaps, + errors: config.indices.errors, + onboarding: config.indices.onboarding, + spans: config.indices.spans, + transactions: config.indices.transactions, + metrics: config.indices.metrics, // system indices, not configurable apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', @@ -64,15 +64,6 @@ export async function getApmIndices({ } } -const APM_UI_INDICES: Array = [ - 'xpack.apm.sourcemapIndices', - 'xpack.apm.errorIndices', - 'xpack.apm.onboardingIndices', - 'xpack.apm.spanIndices', - 'xpack.apm.transactionIndices', - 'xpack.apm.metricsIndices', -]; - export async function getApmIndexSettings({ context, config, @@ -91,8 +82,12 @@ export async function getApmIndexSettings({ } const apmIndicesConfig = getApmIndicesConfig(config); - return APM_UI_INDICES.map((configurationName) => ({ - configurationName, + const apmIndices = Object.keys(config.indices) as Array< + keyof typeof config.indices + >; + + return apmIndices.map((configurationName) => ({ + configurationName: configurationName, defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml savedValue: apmIndicesSavedObject[configurationName], // value saved via Saved Objects service })); diff --git a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts index e940100edcf52..60a28fd9abdbd 100644 --- a/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts +++ b/x-pack/plugins/apm/server/lib/traces/get_trace_items.ts @@ -24,7 +24,7 @@ export async function getTraceItems( end: number ) { const { apmEventClient, config } = setup; - const maxTraceItems = config['xpack.apm.ui.maxTraceItems']; + const maxTraceItems = config.ui.maxTraceItems; const excludedLogLevels = ['debug', 'info', 'warning']; const errorResponsePromise = apmEventClient.search('get_errors_docs', { @@ -80,9 +80,5 @@ export async function getTraceItems( const traceDocs = traceResponse.hits.hits.map((hit) => hit._source); const errorDocs = errorResponse.hits.hits.map((hit) => hit._source); - return { - exceedsMax, - traceDocs, - errorDocs, - }; + return { exceedsMax, traceDocs, errorDocs }; } diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index ab75ec7f36126..7c4543cf3eda3 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -13,12 +13,12 @@ import { APMConfig } from '../../..'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; const mockIndices = { - 'xpack.apm.sourcemapIndices': 'myIndex', - 'xpack.apm.errorIndices': 'myIndex', - 'xpack.apm.onboardingIndices': 'myIndex', - 'xpack.apm.spanIndices': 'myIndex', - 'xpack.apm.transactionIndices': 'myIndex', - 'xpack.apm.metricsIndices': 'myIndex', + sourcemaps: 'myIndex', + errors: 'myIndex', + onboarding: 'myIndex', + spans: 'myIndex', + transactions: 'myIndex', + metrics: 'myIndex', apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }; diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts index 62277dba8ac29..a5c11776c70b0 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.ts @@ -124,7 +124,7 @@ export async function getTransactionBreakdown({ date_histogram: getMetricsDateHistogramParams({ start, end, - metricsInterval: config['xpack.apm.metricsInterval'], + metricsInterval: config.metricsInterval, }), aggs: subAggs, }, diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index 492623edf3e06..cec4f1138ece4 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { map, take } from 'rxjs/operators'; +import { take } from 'rxjs/operators'; import { CoreSetup, CoreStart, @@ -18,8 +18,8 @@ import { isEmpty, mapValues } from 'lodash'; import { SavedObjectsClient } from '../../../../src/core/server'; import { mappingFromFieldMap } from '../../rule_registry/common/mapping_from_field_map'; import { Dataset } from '../../rule_registry/server'; -import { APMConfig, APMXPackConfig, APM_SERVER_FEATURE_ID } from '.'; -import { mergeConfigs } from './index'; +import { /*APMConfig,*/ APMConfig, APM_SERVER_FEATURE_ID } from '.'; +// import { getFullPathConfigs } from './index'; import { UI_SETTINGS } from '../../../../src/plugins/data/common'; import { APM_FEATURE, registerFeaturesUsage } from './feature'; import { registerApmAlerts } from './lib/alerts/register_apm_alerts'; @@ -72,28 +72,32 @@ export class APMPlugin plugins: Omit ) { this.logger = this.initContext.logger.get(); - const config$ = this.initContext.config.create(); - const mergedConfig$ = config$.pipe( - map((apmConfig) => mergeConfigs(apmConfig)) - ); + const config$ = this.initContext.config.create(); + // const mergedConfig$ = config$.pipe( + // map((apmConfig) => getFullPathConfigs(apmConfig)) + // ); core.savedObjects.registerType(apmIndices); core.savedObjects.registerType(apmTelemetry); core.savedObjects.registerType(apmServerSettings); - const currentConfig = mergeConfigs( - this.initContext.config.get() - ); + // const currentConfig = getFullPathConfigs( + // this.initContext.config.get() + // ); + // this.currentConfig = currentConfig; + const currentConfig = this.initContext.config.get(); this.currentConfig = currentConfig; if ( plugins.taskManager && plugins.usageCollection && - currentConfig['xpack.apm.telemetryCollectionEnabled'] + currentConfig.telemetryCollectionEnabled + // currentConfig['xpack.apm.telemetryCollectionEnabled'] ) { createApmTelemetry({ core, - config$: mergedConfig$, + // config$: mergedConfig$, + config$, usageCollector: plugins.usageCollection, taskManager: plugins.taskManager, logger: this.logger, @@ -154,7 +158,7 @@ export class APMPlugin const boundGetApmIndices = async () => getApmIndices({ savedObjectsClient: await getInternalSavedObjectsClient(core), - config: await mergedConfig$.pipe(take(1)).toPromise(), + config: await config$.pipe(take(1)).toPromise(), }); boundGetApmIndices().then((indices) => { @@ -191,7 +195,7 @@ export class APMPlugin ruleDataClient, alerting: plugins.alerting, ml: plugins.ml, - config$: mergedConfig$, + config$, logger: this.logger!.get('rule'), }); } @@ -229,7 +233,7 @@ export class APMPlugin }); return { - config$: mergedConfig$, + config$, getApmIndices: boundGetApmIndices, createApmEventClient: async ({ request, diff --git a/x-pack/plugins/apm/server/routes/fleet.ts b/x-pack/plugins/apm/server/routes/fleet.ts index 5bfbfef5e6800..8b3fc7e66c6dd 100644 --- a/x-pack/plugins/apm/server/routes/fleet.ts +++ b/x-pack/plugins/apm/server/routes/fleet.ts @@ -129,8 +129,7 @@ const getMigrationCheckRoute = createApmServerRoute({ options: { tags: ['access:apm'] }, handler: async (resources) => { const { plugins, context, config, request } = resources; - const cloudApmMigrationEnabled = - config['xpack.apm.agent.migrations.enabled']; + const cloudApmMigrationEnabled = config.agent.migrations.enabled; if (!plugins.fleet || !plugins.security) { throw Boom.internal(FLEET_SECURITY_REQUIRED_MESSAGE); } @@ -158,8 +157,7 @@ const createCloudApmPackagePolicyRoute = createApmServerRoute({ options: { tags: ['access:apm', 'access:apm_write'] }, handler: async (resources) => { const { plugins, context, config, request, logger } = resources; - const cloudApmMigrationEnabled = - config['xpack.apm.agent.migrations.enabled']; + const cloudApmMigrationEnabled = config.agent.migrations.enabled; if (!plugins.fleet || !plugins.security) { throw Boom.internal(FLEET_SECURITY_REQUIRED_MESSAGE); } diff --git a/x-pack/plugins/apm/server/routes/service_map.ts b/x-pack/plugins/apm/server/routes/service_map.ts index 8fb3abe99e36c..11a2e8bb445a8 100644 --- a/x-pack/plugins/apm/server/routes/service_map.ts +++ b/x-pack/plugins/apm/server/routes/service_map.ts @@ -33,7 +33,7 @@ const serviceMapRoute = createApmServerRoute({ options: { tags: ['access:apm'] }, handler: async (resources) => { const { config, context, params, logger } = resources; - if (!config['xpack.apm.serviceMapEnabled']) { + if (!config.serviceMapEnabled) { throw Boom.notFound(); } if (!isActivePlatinumLicense(context.licensing.license)) { @@ -81,7 +81,7 @@ const serviceMapServiceNodeRoute = createApmServerRoute({ handler: async (resources) => { const { config, context, params } = resources; - if (!config['xpack.apm.serviceMapEnabled']) { + if (!config.serviceMapEnabled) { throw Boom.notFound(); } if (!isActivePlatinumLicense(context.licensing.license)) { @@ -125,7 +125,7 @@ const serviceMapBackendNodeRoute = createApmServerRoute({ handler: async (resources) => { const { config, context, params } = resources; - if (!config['xpack.apm.serviceMapEnabled']) { + if (!config.serviceMapEnabled) { throw Boom.notFound(); } if (!isActivePlatinumLicense(context.licensing.license)) { diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index ef85b6ee4fb8b..29ee3359a183f 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -45,12 +45,12 @@ const saveApmIndicesRoute = createApmServerRoute({ }, params: t.type({ body: t.partial({ - 'xpack.apm.sourcemapIndices': t.string, - 'xpack.apm.errorIndices': t.string, - 'xpack.apm.onboardingIndices': t.string, - 'xpack.apm.spanIndices': t.string, - 'xpack.apm.transactionIndices': t.string, - 'xpack.apm.metricsIndices': t.string, + sourcemaps: t.string, + errors: t.string, + onboarding: t.string, + spans: t.string, + transactions: t.string, + metrics: t.string, }), }), handler: async (resources) => { diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts index 2d855cb515e17..0be512a4fd17f 100644 --- a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts +++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts @@ -15,24 +15,12 @@ export const apmIndices: SavedObjectsType = { namespaceType: 'agnostic', mappings: { properties: { - 'xpack.apm.sourcemapIndices': { - type: 'keyword', - }, - 'xpack.apm.errorIndices': { - type: 'keyword', - }, - 'xpack.apm.onboardingIndices': { - type: 'keyword', - }, - 'xpack.apm.spanIndices': { - type: 'keyword', - }, - 'xpack.apm.transactionIndices': { - type: 'keyword', - }, - 'xpack.apm.metricsIndices': { - type: 'keyword', - }, + sourcemaps: { type: 'keyword' }, + errors: { type: 'keyword' }, + onboarding: { type: 'keyword' }, + spans: { type: 'keyword' }, + transactions: { type: 'keyword' }, + metrics: { type: 'keyword' }, }, }, management: { diff --git a/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts index 5999a37ee44b1..49ea9076b0087 100644 --- a/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts +++ b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts @@ -5,35 +5,32 @@ * 2.0. */ -const apmIndexConfigPaths = [ - ['xpack.apm.sourcemapIndices', 'apm_oss.sourcemapIndices'], - ['xpack.apm.errorIndices', 'apm_oss.errorIndices'], - ['xpack.apm.onboardingIndices', 'apm_oss.onboardingIndices'], - ['xpack.apm.spanIndices', 'apm_oss.spanIndices'], - ['xpack.apm.transactionIndices', 'apm_oss.transactionIndices'], - ['xpack.apm.metricsIndices', 'apm_oss.metricsIndices'], +const apmIndexConfigs = [ + ['sourcemaps', 'apm_oss.sourcemapIndices'], + ['errors', 'apm_oss.errorIndices'], + ['onboarding', 'apm_oss.onboardingIndices'], + ['spans', 'apm_oss.spanIndices'], + ['transactions', 'apm_oss.transactionIndices'], + ['metrics', 'apm_oss.metricsIndices'], ] as const; -type ApmIndexConfigsPaths = typeof apmIndexConfigPaths[number][0]; +type ApmIndexConfigs = typeof apmIndexConfigs[number][0]; type ApmIndicesSavedObjectAttributes = Partial<{ - [Property in ApmIndexConfigsPaths]: string; + [Property in ApmIndexConfigs]: string; }>; -type DeprecatedApmIndexConfigsPaths = typeof apmIndexConfigPaths[number][1]; +type DeprecatedApmIndexConfigPaths = typeof apmIndexConfigs[number][1]; type DeprecatedApmIndicesSavedObjectAttributes = Partial<{ - [Property in DeprecatedApmIndexConfigsPaths]: string; + [Property in DeprecatedApmIndexConfigPaths]: string; }>; export function updateApmOssIndexPaths( attributes: DeprecatedApmIndicesSavedObjectAttributes ) { - return apmIndexConfigPaths.reduce( - (attrs, [configPath, deprecatedConfigPath]) => { - const indexConfig: string | undefined = attributes[deprecatedConfigPath]; - if (indexConfig) { - attrs[configPath] = indexConfig; - } - return attrs; - }, - {} as ApmIndicesSavedObjectAttributes - ); + return apmIndexConfigs.reduce((attrs, [configPath, deprecatedConfigPath]) => { + const indexConfig: string | undefined = attributes[deprecatedConfigPath]; + if (indexConfig) { + attrs[configPath] = indexConfig; + } + return attrs; + }, {} as ApmIndicesSavedObjectAttributes); } diff --git a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index 2fc9d5d6cb2e2..4d617e6a47e42 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -37,13 +37,7 @@ export function onPremInstructions({ apmConfig, isFleetPluginEnabled, }: { - apmConfig: Pick< - APMConfig, - | 'xpack.apm.errorIndices' - | 'xpack.apm.transactionIndices' - | 'xpack.apm.metricsIndices' - | 'xpack.apm.onboardingIndices' - >; + apmConfig: APMConfig; isFleetPluginEnabled: boolean; }): InstructionsSchema { const EDIT_CONFIG = createEditConfig(); @@ -144,7 +138,7 @@ export function onPremInstructions({ } ), esHitsCheck: { - index: apmConfig['xpack.apm.onboardingIndices'], + index: apmConfig.indices.onboarding, query: { bool: { filter: [ @@ -237,9 +231,9 @@ export function onPremInstructions({ ), esHitsCheck: { index: [ - apmConfig['xpack.apm.errorIndices'], - apmConfig['xpack.apm.transactionIndices'], - apmConfig['xpack.apm.metricsIndices'], + apmConfig.indices.errors, + apmConfig.indices.transactions, + apmConfig.indices.metrics, ], query: { bool: { diff --git a/x-pack/plugins/apm/server/tutorial/index.ts b/x-pack/plugins/apm/server/tutorial/index.ts index 66e6ffaed95a8..5caf2b4372483 100644 --- a/x-pack/plugins/apm/server/tutorial/index.ts +++ b/x-pack/plugins/apm/server/tutorial/index.ts @@ -67,7 +67,7 @@ export const tutorialProvider = ], }; - if (apmConfig['xpack.apm.ui.enabled']) { + if (apmConfig.ui.enabled) { // @ts-expect-error artifacts.application is readonly artifacts.application = { path: '/app/apm', diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 10b6695005733..290a03220ef56 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -27,12 +27,12 @@ interface MockSetup { config: APMConfig; uiFilters: UxUIFilters; indices: { - 'xpack.apm.sourcemapIndices': string; - 'xpack.apm.errorIndices': string; - 'xpack.apm.onboardingIndices': string; - 'xpack.apm.spanIndices': string; - 'xpack.apm.transactionIndices': string; - 'xpack.apm.metricsIndices': string; + sourcemaps: string; + errors: string; + onboarding: string; + spans: string; + transactions: string; + metrics: string; apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; }; @@ -74,8 +74,9 @@ export async function inspectSearchParams( switch (key) { default: return 'myIndex'; - - case 'xpack.apm.metricsInterval': + case 'indices': + return new Proxy({}, { get: () => 'myIndex' }); + case 'metricsInterval': return 30; } }, @@ -83,12 +84,12 @@ export async function inspectSearchParams( ) as APMConfig, uiFilters: options?.uiFilters ?? {}, indices: { - 'xpack.apm.sourcemapIndices': 'myIndex', - 'xpack.apm.errorIndices': 'myIndex', - 'xpack.apm.onboardingIndices': 'myIndex', - 'xpack.apm.spanIndices': 'myIndex', - 'xpack.apm.transactionIndices': 'myIndex', - 'xpack.apm.metricsIndices': 'myIndex', + sourcemaps: 'myIndex', + errors: 'myIndex', + onboarding: 'myIndex', + spans: 'myIndex', + transactions: 'myIndex', + metrics: 'myIndex', apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }, diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index 657841e59ff0a..b9edb51760a32 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -16,12 +16,12 @@ export const alertWorkflowStatusRt = t.keyof({ export type AlertWorkflowStatus = t.TypeOf; export interface ApmIndicesConfig { - 'xpack.apm.sourcemapIndices': string; - 'xpack.apm.errorIndices': string; - 'xpack.apm.onboardingIndices': string; - 'xpack.apm.spanIndices': string; - 'xpack.apm.transactionIndices': string; - 'xpack.apm.metricsIndices': string; + sourcemaps: string; + errors: string; + onboarding: string; + spans: string; + transactions: string; + metrics: string; apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx index 5245030a64662..36dcd93b7d7ee 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -65,7 +65,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { case 'mobile': const resultApm = await getDataHandler('apm')?.hasData(); hasDataT = Boolean(resultApm?.hasData); - indices = resultApm?.indices['xpack.apm.transactionIndices']; + indices = resultApm?.indices.transactions; break; } setHasAppData((prevState) => ({ ...prevState, [dataType]: hasDataT })); diff --git a/x-pack/plugins/observability/public/context/has_data_context.test.tsx b/x-pack/plugins/observability/public/context/has_data_context.test.tsx index dc227936aeafc..72cfe68a583ef 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.test.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.test.tsx @@ -24,7 +24,7 @@ import { act } from '@testing-library/react'; const relativeStart = '2020-10-08T06:00:00.000Z'; const relativeEnd = '2020-10-08T07:00:00.000Z'; -const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; function wrapper({ children }: { children: React.ReactElement }) { const history = createMemoryHistory(); diff --git a/x-pack/plugins/observability/public/data_handler.test.ts b/x-pack/plugins/observability/public/data_handler.test.ts index 441de2e44af1d..127b00349d43f 100644 --- a/x-pack/plugins/observability/public/data_handler.test.ts +++ b/x-pack/plugins/observability/public/data_handler.test.ts @@ -9,7 +9,7 @@ import { registerDataHandler, getDataHandler } from './data_handler'; import moment from 'moment'; import { ApmIndicesConfig } from '../common/typings'; -const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; const params = { absoluteTime: { diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 8bac62402d538..8eded3fad7dac 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -36,7 +36,7 @@ function unregisterAll() { unregisterDataHandler({ appName: 'synthetics' }); } -const sampleAPMIndices = { 'xpack.apm.transactionIndices': 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; const withCore = makeDecorator({ name: 'withCore', diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json index f1dfc542dad5c..daa99c4d71967 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects/mappings.json @@ -189,31 +189,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json index fae1a1379f5ad..4e41d8cb72fb5 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/encrypted_saved_objects_different_key/mappings.json @@ -216,31 +216,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json index b430bf962fb4a..9164430730216 100644 --- a/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json +++ b/x-pack/test/encrypted_saved_objects_api_integration/fixtures/es_archiver/key_rotation/mappings.json @@ -214,31 +214,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/action_task_params/mappings.json b/x-pack/test/functional/es_archives/action_task_params/mappings.json index ab08540a145b0..874886647e6d6 100644 --- a/x-pack/test/functional/es_archives/action_task_params/mappings.json +++ b/x-pack/test/functional/es_archives/action_task_params/mappings.json @@ -206,31 +206,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/actions/mappings.json b/x-pack/test/functional/es_archives/actions/mappings.json index 6351edc05d02c..786005d1ab6a6 100644 --- a/x-pack/test/functional/es_archives/actions/mappings.json +++ b/x-pack/test/functional/es_archives/actions/mappings.json @@ -202,31 +202,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/alerts_legacy/mappings.json b/x-pack/test/functional/es_archives/alerts_legacy/mappings.json index 6e7361ead2601..9c856a829a343 100644 --- a/x-pack/test/functional/es_archives/alerts_legacy/mappings.json +++ b/x-pack/test/functional/es_archives/alerts_legacy/mappings.json @@ -198,31 +198,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/canvas/reports/mappings.json b/x-pack/test/functional/es_archives/canvas/reports/mappings.json index 68f34d37dbd3d..51c48857d2481 100644 --- a/x-pack/test/functional/es_archives/canvas/reports/mappings.json +++ b/x-pack/test/functional/es_archives/canvas/reports/mappings.json @@ -229,31 +229,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json index 62049be7d9dcc..bd0b2c4e9ad27 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.10.0/mappings.json @@ -199,31 +199,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json index de4e11dee2f25..2da75330be93a 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.11.1/mappings.json @@ -254,31 +254,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json index cf82159d06b48..62fec329aa40f 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.13.2/mappings.json @@ -260,31 +260,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json index cf2442c59c6b0..8a9c1a626e652 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.13_user_actions/mappings.json @@ -261,31 +261,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/cases/migrations/7.16.0_space/mappings.json b/x-pack/test/functional/es_archives/cases/migrations/7.16.0_space/mappings.json index 51fe50218b1f5..4b8f2c7103b20 100644 --- a/x-pack/test/functional/es_archives/cases/migrations/7.16.0_space/mappings.json +++ b/x-pack/test/functional/es_archives/cases/migrations/7.16.0_space/mappings.json @@ -275,27 +275,23 @@ }, "apm-indices": { "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/data/search_sessions/mappings.json b/x-pack/test/functional/es_archives/data/search_sessions/mappings.json index f61db73871acd..1203e1d892d56 100644 --- a/x-pack/test/functional/es_archives/data/search_sessions/mappings.json +++ b/x-pack/test/functional/es_archives/data/search_sessions/mappings.json @@ -169,31 +169,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json index 08a9d3b8f893e..daab89b69483e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/agent_only/mappings.json @@ -198,31 +198,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json index 4e6ebd37527aa..c133c3fec76e2 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_different_states/mappings.json @@ -199,31 +199,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json index 4e6ebd37527aa..c133c3fec76e2 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_installed/mappings.json @@ -199,31 +199,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json index 4e6ebd37527aa..c133c3fec76e2 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/cloned_endpoint_uninstalled/mappings.json @@ -199,31 +199,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json index 08a9d3b8f893e..daab89b69483e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_disabled/mappings.json @@ -198,31 +198,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json index 08a9d3b8f893e..daab89b69483e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_malware_enabled/mappings.json @@ -198,31 +198,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json index 08a9d3b8f893e..daab89b69483e 100644 --- a/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json +++ b/x-pack/test/functional/es_archives/endpoint/telemetry/endpoint_uninstalled/mappings.json @@ -198,31 +198,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/fleet/agents/mappings.json b/x-pack/test/functional/es_archives/fleet/agents/mappings.json index e294fe5bc8845..b2f5392ebd23a 100644 --- a/x-pack/test/functional/es_archives/fleet/agents/mappings.json +++ b/x-pack/test/functional/es_archives/fleet/agents/mappings.json @@ -189,31 +189,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json b/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json index d8aa7f2a5fc68..7853368bc37d5 100644 --- a/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json +++ b/x-pack/test/functional/es_archives/kibana_scripted_fields_on_logstash/mappings.json @@ -181,31 +181,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/lists/mappings.json b/x-pack/test/functional/es_archives/lists/mappings.json index f33d0a9ee6b17..e23c5ad224506 100644 --- a/x-pack/test/functional/es_archives/lists/mappings.json +++ b/x-pack/test/functional/es_archives/lists/mappings.json @@ -196,31 +196,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json b/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json index a6df85c97779c..a35e4c8e07e97 100644 --- a/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/canvas_disallowed_url/mappings.json @@ -193,31 +193,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json b/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json index 295236e90c181..9d11349819d68 100644 --- a/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/ecommerce_kibana_spaces/mappings.json @@ -214,31 +214,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json b/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json index 143547d17d214..02a212d65cc1a 100644 --- a/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/hugedata/mappings.json @@ -170,31 +170,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json b/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json index 74a554910da33..f6b5df41938fb 100644 --- a/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json +++ b/x-pack/test/functional/es_archives/reporting/multi_index_kibana/mappings.json @@ -172,31 +172,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/security_solution/migrations/mappings.json b/x-pack/test/functional/es_archives/security_solution/migrations/mappings.json index 5a602322b3017..fa49916066a1a 100644 --- a/x-pack/test/functional/es_archives/security_solution/migrations/mappings.json +++ b/x-pack/test/functional/es_archives/security_solution/migrations/mappings.json @@ -272,27 +272,23 @@ }, "apm-indices": { "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json index cf32d22feb11f..2e6a9bcee3d8c 100644 --- a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json +++ b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0/mappings.json @@ -276,31 +276,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, diff --git a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/mappings.json b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/mappings.json index 0fa5a458f6995..682b241c126f4 100644 --- a/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/mappings.json +++ b/x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/mappings.json @@ -273,27 +273,23 @@ }, "apm-indices": { "properties": { - "apm_oss": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, @@ -3089,4 +3085,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/test/functional/es_archives/visualize/default/mappings.json b/x-pack/test/functional/es_archives/visualize/default/mappings.json index 62b3f9105e2c2..2d761064d0a46 100644 --- a/x-pack/test/functional/es_archives/visualize/default/mappings.json +++ b/x-pack/test/functional/es_archives/visualize/default/mappings.json @@ -254,31 +254,23 @@ }, "apm-indices": { "properties": { - "xpack": { - "properties": { - "apm": { - "properties": { - "errorIndices": { - "type": "keyword" - }, - "metricsIndices": { - "type": "keyword" - }, - "onboardingIndices": { - "type": "keyword" - }, - "sourcemapIndices": { - "type": "keyword" - }, - "spanIndices": { - "type": "keyword" - }, - "transactionIndices": { - "type": "keyword" - } - } - } - } + "errors": { + "type": "keyword" + }, + "metrics": { + "type": "keyword" + }, + "onboarding": { + "type": "keyword" + }, + "sourcemaps": { + "type": "keyword" + }, + "spans": { + "type": "keyword" + }, + "transactions": { + "type": "keyword" } } }, From d9d27b8501b07f5901944f0308d35edd38d862f0 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Tue, 12 Oct 2021 00:43:59 -0400 Subject: [PATCH 14/17] fixes proxy mock object in unit test --- .../traces/__snapshots__/queries.test.ts.snap | 2 +- .../plugins/apm/server/utils/test_helpers.tsx | 23 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap b/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap index 53318fe5fe594..ea8f39f9d9b6d 100644 --- a/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap +++ b/x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap @@ -37,7 +37,7 @@ Object { }, }, }, - "size": "myIndex", + "size": 1000, }, } `; diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 290a03220ef56..68447f4ad7928 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -59,6 +59,14 @@ export async function inspectSearchParams( let response; let error; + const mockApmIndices = { + sourcemaps: 'myIndex', + errors: 'myIndex', + onboarding: 'myIndex', + spans: 'myIndex', + transactions: 'myIndex', + metrics: 'myIndex', + }; const mockSetup = { apmEventClient: { search: spy } as any, internalClient: { search: spy } as any, @@ -75,7 +83,13 @@ export async function inspectSearchParams( default: return 'myIndex'; case 'indices': - return new Proxy({}, { get: () => 'myIndex' }); + return mockApmIndices; + case 'ui': + return { + enabled: true, + transactionGroupBucketSize: 1000, + maxTraceItems: 1000, + }; case 'metricsInterval': return 30; } @@ -84,12 +98,7 @@ export async function inspectSearchParams( ) as APMConfig, uiFilters: options?.uiFilters ?? {}, indices: { - sourcemaps: 'myIndex', - errors: 'myIndex', - onboarding: 'myIndex', - spans: 'myIndex', - transactions: 'myIndex', - metrics: 'myIndex', + ...mockApmIndices, apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }, From 7965f998f0fd96daaff7fcded56270e49daf0246 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Tue, 12 Oct 2021 01:48:09 -0400 Subject: [PATCH 15/17] fixes linting issues --- .../lib/settings/apm_indices/get_apm_indices.ts | 2 +- x-pack/plugins/apm/server/plugin.ts | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index 342d49a85d81b..2e75aec69a3fb 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -87,7 +87,7 @@ export async function getApmIndexSettings({ >; return apmIndices.map((configurationName) => ({ - configurationName: configurationName, + configurationName, defaultValue: apmIndicesConfig[configurationName], // value defined in kibana[.dev].yml savedValue: apmIndicesSavedObject[configurationName], // value saved via Saved Objects service })); diff --git a/x-pack/plugins/apm/server/plugin.ts b/x-pack/plugins/apm/server/plugin.ts index cec4f1138ece4..d2d8dbf602364 100644 --- a/x-pack/plugins/apm/server/plugin.ts +++ b/x-pack/plugins/apm/server/plugin.ts @@ -18,8 +18,7 @@ import { isEmpty, mapValues } from 'lodash'; import { SavedObjectsClient } from '../../../../src/core/server'; import { mappingFromFieldMap } from '../../rule_registry/common/mapping_from_field_map'; import { Dataset } from '../../rule_registry/server'; -import { /*APMConfig,*/ APMConfig, APM_SERVER_FEATURE_ID } from '.'; -// import { getFullPathConfigs } from './index'; +import { APMConfig, APM_SERVER_FEATURE_ID } from '.'; import { UI_SETTINGS } from '../../../../src/plugins/data/common'; import { APM_FEATURE, registerFeaturesUsage } from './feature'; import { registerApmAlerts } from './lib/alerts/register_apm_alerts'; @@ -73,18 +72,11 @@ export class APMPlugin ) { this.logger = this.initContext.logger.get(); const config$ = this.initContext.config.create(); - // const mergedConfig$ = config$.pipe( - // map((apmConfig) => getFullPathConfigs(apmConfig)) - // ); core.savedObjects.registerType(apmIndices); core.savedObjects.registerType(apmTelemetry); core.savedObjects.registerType(apmServerSettings); - // const currentConfig = getFullPathConfigs( - // this.initContext.config.get() - // ); - // this.currentConfig = currentConfig; const currentConfig = this.initContext.config.get(); this.currentConfig = currentConfig; @@ -92,11 +84,9 @@ export class APMPlugin plugins.taskManager && plugins.usageCollection && currentConfig.telemetryCollectionEnabled - // currentConfig['xpack.apm.telemetryCollectionEnabled'] ) { createApmTelemetry({ core, - // config$: mergedConfig$, config$, usageCollector: plugins.usageCollection, taskManager: plugins.taskManager, From e79e90fe4ba498c577d5fddac9b7a946742083b5 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Tue, 12 Oct 2021 10:42:26 -0400 Subject: [PATCH 16/17] PR feedback and failed test --- docs/developer/plugin-list.asciidoc | 4 ---- .../resources/base/bin/kibana-docker | 12 ++++++------ .../plugins/apm/scripts/shared/read-kibana-config.ts | 8 ++++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 0e728a4dada24..0723040d08da3 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -28,10 +28,6 @@ allowing users to configure their advanced settings, also known as uiSettings within the code. -|{kib-repo}blob/{branch}/src/plugins/apm_oss/README.asciidoc[apmOss] -|undefined - - |{kib-repo}blob/{branch}/src/plugins/bfetch/README.md[bfetch] |bfetch allows to batch HTTP requests and streams responses back. diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 29308825ec8e4..9e7766ce16c9b 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -211,12 +211,12 @@ kibana_vars=( xpack.alerts.invalidateApiKeysTask.interval xpack.alerts.invalidateApiKeysTask.removalDelay xpack.apm.enabled - xpack.apm.errors - xpack.apm.metrics - xpack.apm.onboarding - xpack.apm.sourcemaps - xpack.apm.spans - xpack.apm.transactions + xpack.apm.indices.errors + xpack.apm.indices.metrics + xpack.apm.indices.onboarding + xpack.apm.indices.sourcemaps + xpack.apm.indices.spans + xpack.apm.indices.transactions xpack.apm.maxServiceEnvironments xpack.apm.searchAggregatedTransactions xpack.apm.serviceMapEnabled diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index dbdb2278b15a0..d44ddaf3d2038 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -38,10 +38,10 @@ export const readKibanaConfig = () => { }; return { - 'xpack.apm.indices.transactions': 'apm-*', - 'xpack.apm.indices.metrics': 'apm-*', - 'xpack.apm.indices.errors': 'apm-*', - 'xpack.apm.indices.spans': 'apm-*', + 'xpack.apm.indices.transactions': 'traces-apm*,apm-*', + 'xpack.apm.indices.metrics': 'metrics-apm*,apm-*', + 'xpack.apm.indices.errors': 'logs-apm*,apm-*', + 'xpack.apm.indices.spans': 'traces-apm*,apm-*', 'xpack.apm.indices.onboarding': 'apm-*', 'xpack.apm.indices.sourcemaps': 'apm-*', 'elasticsearch.hosts': 'http://localhost:9200', From 2812ccaa7471222c055f9bde1721034257d6f7b5 Mon Sep 17 00:00:00 2001 From: Oliver Gupte Date: Wed, 13 Oct 2021 01:14:22 -0400 Subject: [PATCH 17/17] changes the configs at `xpack.apm.indices.*` from plural to singular to match `processor.event` values --- .../app/Settings/ApmIndices/index.tsx | 10 +-- .../apm/scripts/shared/read-kibana-config.ts | 10 +-- .../scripts/upload-telemetry-data/index.ts | 10 +-- x-pack/plugins/apm/server/index.ts | 21 ++++--- .../alerts/register_error_count_alert_type.ts | 2 +- ...egister_transaction_duration_alert_type.ts | 4 +- ...ister_transaction_error_rate_alert_type.ts | 4 +- .../apm/server/lib/alerts/test_utils/index.ts | 4 +- .../create_anomaly_detection_jobs.ts | 2 +- .../collect_data_telemetry/tasks.test.ts | 8 +-- .../collect_data_telemetry/tasks.ts | 62 +++++++++---------- .../errors/distribution/get_buckets.test.ts | 10 +-- .../unpack_processor_events.test.ts | 10 +-- .../unpack_processor_events.ts | 10 +-- .../server/lib/helpers/setup_request.test.ts | 21 ++++--- .../create_static_index_pattern.test.ts | 10 +-- .../get_apm_index_pattern_title.test.ts | 16 ++--- .../get_apm_index_pattern_title.ts | 8 +-- .../apm/server/lib/rum_client/has_rum_data.ts | 4 +- ...ransactions_correlations_search_service.ts | 2 +- .../latency_correlations_search_service.ts | 2 +- .../search_strategy_provider.test.ts | 2 +- .../settings/apm_indices/get_apm_indices.ts | 10 +-- .../lib/transactions/breakdown/index.test.ts | 13 ++-- .../apm/server/routes/settings/apm_indices.ts | 17 +++-- .../apm/server/saved_objects/apm_indices.ts | 22 ++++--- .../migrations/update_apm_oss_index_paths.ts | 10 +-- .../apm/server/tutorial/envs/on_prem.ts | 6 +- .../plugins/apm/server/utils/test_helpers.tsx | 26 +++----- .../plugins/observability/common/typings.ts | 10 +-- .../hooks/use_app_index_pattern.tsx | 2 +- .../public/context/has_data_context.test.tsx | 2 +- .../observability/public/data_handler.test.ts | 2 +- .../pages/overview/overview.stories.tsx | 2 +- 34 files changed, 180 insertions(+), 174 deletions(-) diff --git a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx index ec4dde31df0b1..2e526eff04346 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/ApmIndices/index.tsx @@ -30,14 +30,14 @@ import { const APM_INDEX_LABELS = [ { - configurationName: 'sourcemaps', + configurationName: 'sourcemap', label: i18n.translate( 'xpack.apm.settings.apmIndices.sourcemapIndicesLabel', { defaultMessage: 'Sourcemap Indices' } ), }, { - configurationName: 'errors', + configurationName: 'error', label: i18n.translate('xpack.apm.settings.apmIndices.errorIndicesLabel', { defaultMessage: 'Error Indices', }), @@ -50,20 +50,20 @@ const APM_INDEX_LABELS = [ ), }, { - configurationName: 'spans', + configurationName: 'span', label: i18n.translate('xpack.apm.settings.apmIndices.spanIndicesLabel', { defaultMessage: 'Span Indices', }), }, { - configurationName: 'transactions', + configurationName: 'transaction', label: i18n.translate( 'xpack.apm.settings.apmIndices.transactionIndicesLabel', { defaultMessage: 'Transaction Indices' } ), }, { - configurationName: 'metrics', + configurationName: 'metric', label: i18n.translate('xpack.apm.settings.apmIndices.metricsIndicesLabel', { defaultMessage: 'Metrics Indices', }), diff --git a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts index d44ddaf3d2038..f3e2b48390468 100644 --- a/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts +++ b/x-pack/plugins/apm/scripts/shared/read-kibana-config.ts @@ -38,12 +38,12 @@ export const readKibanaConfig = () => { }; return { - 'xpack.apm.indices.transactions': 'traces-apm*,apm-*', - 'xpack.apm.indices.metrics': 'metrics-apm*,apm-*', - 'xpack.apm.indices.errors': 'logs-apm*,apm-*', - 'xpack.apm.indices.spans': 'traces-apm*,apm-*', + 'xpack.apm.indices.transaction': 'traces-apm*,apm-*', + 'xpack.apm.indices.metric': 'metrics-apm*,apm-*', + 'xpack.apm.indices.error': 'logs-apm*,apm-*', + 'xpack.apm.indices.span': 'traces-apm*,apm-*', 'xpack.apm.indices.onboarding': 'apm-*', - 'xpack.apm.indices.sourcemaps': 'apm-*', + 'xpack.apm.indices.sourcemap': 'apm-*', 'elasticsearch.hosts': 'http://localhost:9200', ...loadedKibanaConfig, ...cliEsCredentials, diff --git a/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts index 5e5053521db6f..c900123c6cee9 100644 --- a/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts +++ b/x-pack/plugins/apm/scripts/upload-telemetry-data/index.ts @@ -78,12 +78,12 @@ async function uploadData() { collectTelemetryParams: { logger: console as unknown as Logger, indices: { - transactions: config['xpack.apm.indices.transactions'], - metrics: config['xpack.apm.indices.metrics'], - errors: config['xpack.apm.indices.errors'], - spans: config['xpack.apm.indices.spans'], + transaction: config['xpack.apm.indices.transaction'], + metric: config['xpack.apm.indices.metric'], + error: config['xpack.apm.indices.error'], + span: config['xpack.apm.indices.span'], onboarding: config['xpack.apm.indices.onboarding'], - sourcemaps: config['xpack.apm.indices.sourcemaps'], + sourcemap: config['xpack.apm.indices.sourcemap'], apmCustomLinkIndex: '.apm-custom-links', apmAgentConfigurationIndex: '.apm-agent-configuration', }, diff --git a/x-pack/plugins/apm/server/index.ts b/x-pack/plugins/apm/server/index.ts index 91373273238d6..c0dffc50e4e4f 100644 --- a/x-pack/plugins/apm/server/index.ts +++ b/x-pack/plugins/apm/server/index.ts @@ -49,11 +49,11 @@ const configSchema = schema.object({ }), }), indices: schema.object({ - transactions: schema.string({ defaultValue: 'traces-apm*,apm-*' }), - spans: schema.string({ defaultValue: 'traces-apm*,apm-*' }), - errors: schema.string({ defaultValue: 'logs-apm*,apm-*' }), - metrics: schema.string({ defaultValue: 'metrics-apm*,apm-*' }), - sourcemaps: schema.string({ defaultValue: 'apm-*' }), + transaction: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + span: schema.string({ defaultValue: 'traces-apm*,apm-*' }), + error: schema.string({ defaultValue: 'logs-apm*,apm-*' }), + metric: schema.string({ defaultValue: 'metrics-apm*,apm-*' }), + sourcemap: schema.string({ defaultValue: 'apm-*' }), onboarding: schema.string({ defaultValue: 'apm-*' }), }), }); @@ -69,12 +69,12 @@ export const config: PluginConfigDescriptor = { deprecate('enabled', '8.0.0'), renameFromRoot( 'apm_oss.transactionIndices', - 'xpack.apm.indices.transactions' + 'xpack.apm.indices.transaction' ), - renameFromRoot('apm_oss.spanIndices', 'xpack.apm.indices.spans'), - renameFromRoot('apm_oss.errorIndices', 'xpack.apm.indices.errors'), - renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.indices.metrics'), - renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.indices.sourcemaps'), + renameFromRoot('apm_oss.spanIndices', 'xpack.apm.indices.span'), + renameFromRoot('apm_oss.errorIndices', 'xpack.apm.indices.error'), + renameFromRoot('apm_oss.metricsIndices', 'xpack.apm.indices.metric'), + renameFromRoot('apm_oss.sourcemapIndices', 'xpack.apm.indices.sourcemap'), renameFromRoot('apm_oss.onboardingIndices', 'xpack.apm.indices.onboarding'), deprecateFromRoot('apm_oss.enabled', '8.0.0'), unusedFromRoot('apm_oss.fleetMode'), @@ -97,6 +97,7 @@ export const config: PluginConfigDescriptor = { }; export type APMConfig = TypeOf; +export type ApmIndicesConfigName = keyof APMConfig['indices']; export const plugin = (initContext: PluginInitializerContext) => new APMPlugin(initContext); diff --git a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts index e87cb0c8cb9e1..7fe2adcfe24d7 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_error_count_alert_type.ts @@ -99,7 +99,7 @@ export function registerErrorCountAlertType({ }); const searchParams = { - index: indices.errors, + index: indices.error, size: 0, body: { query: { diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts index 82df85a0f516d..df4de254346c9 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_duration_alert_type.ts @@ -119,8 +119,8 @@ export function registerTransactionDurationAlertType({ SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices.metrics - : indices.transactions; + ? indices.metric + : indices.transaction; const field = getTransactionDurationFieldForAggregatedTransactions( searchAggregatedTransactions diff --git a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts index 758066e305a61..598487d02625a 100644 --- a/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts +++ b/x-pack/plugins/apm/server/lib/alerts/register_transaction_error_rate_alert_type.ts @@ -114,8 +114,8 @@ export function registerTransactionErrorRateAlertType({ SearchAggregatedTransactionSetting.never; const index = searchAggregatedTransactions - ? indices.metrics - : indices.transactions; + ? indices.metric + : indices.transaction; const searchParams = { index, diff --git a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts index 68bd113c52cb3..22649a7010461 100644 --- a/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts +++ b/x-pack/plugins/apm/server/lib/alerts/test_utils/index.ts @@ -18,8 +18,8 @@ export const createRuleTypeMocks = () => { const mockedConfig$ = of({ indices: { - errors: 'apm-*', - transactions: 'apm-*', + error: 'apm-*', + transaction: 'apm-*', }, } as APMConfig); diff --git a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts index 63f78b0be9d27..10758b6d90cdc 100644 --- a/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts +++ b/x-pack/plugins/apm/server/lib/anomaly_detection/create_anomaly_detection_jobs.ts @@ -50,7 +50,7 @@ export async function createAnomalyDetectionJobs( `Creating ML anomaly detection jobs for environments: [${uniqueMlJobEnvs}].` ); - const indexPatternName = indices.metrics; + const indexPatternName = indices.metric; const responses = await Promise.all( uniqueMlJobEnvs.map((environment) => createAnomalyDetectionJob({ ml, environment, indexPatternName }) diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts index 3fe7b698f34cc..1e697ebdcae06 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.test.ts @@ -14,10 +14,10 @@ import { describe('data telemetry collection tasks', () => { const indices = { - errors: 'apm-8.0.0-error', - metrics: 'apm-8.0.0-metric', - spans: 'apm-8.0.0-span', - transactions: 'apm-8.0.0-transaction', + error: 'apm-8.0.0-error', + metric: 'apm-8.0.0-metric', + span: 'apm-8.0.0-span', + transaction: 'apm-8.0.0-transaction', } as ApmIndicesConfig; describe('environments', () => { diff --git a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts index 07a95a9089612..8764223ad1ebb 100644 --- a/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts +++ b/x-pack/plugins/apm/server/lib/apm_telemetry/collect_data_telemetry/tasks.ts @@ -78,7 +78,7 @@ export const tasks: TelemetryTask[] = [ }; const params = { - index: [indices.transactions], + index: [indices.transaction], body: { size: 0, timeout, @@ -138,7 +138,7 @@ export const tasks: TelemetryTask[] = [ // fixed date range for reliable results const lastTransaction = ( await search({ - index: indices.transactions, + index: indices.transaction, body: { query: { bool: { @@ -253,10 +253,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices.errors, - indices.metrics, - indices.spans, - indices.transactions, + indices.error, + indices.metric, + indices.span, + indices.transaction, ], body: { size: 0, @@ -310,10 +310,10 @@ export const tasks: TelemetryTask[] = [ const response = await search({ index: [ - indices.errors, - indices.metrics, - indices.spans, - indices.transactions, + indices.error, + indices.metric, + indices.span, + indices.transaction, ], body: { size: 0, @@ -345,7 +345,7 @@ export const tasks: TelemetryTask[] = [ name: 'environments', executor: async ({ indices, search }) => { const response = await search({ - index: [indices.transactions], + index: [indices.transaction], body: { query: { bool: { @@ -426,12 +426,12 @@ export const tasks: TelemetryTask[] = [ name: 'processor_events', executor: async ({ indices, search }) => { const indicesByProcessorEvent = { - error: indices.errors, - metric: indices.metrics, - span: indices.spans, - transaction: indices.transactions, + error: indices.error, + metric: indices.metric, + span: indices.span, + transaction: indices.transaction, onboarding: indices.onboarding, - sourcemap: indices.sourcemaps, + sourcemap: indices.sourcemap, }; type ProcessorEvent = keyof typeof indicesByProcessorEvent; @@ -549,10 +549,10 @@ export const tasks: TelemetryTask[] = [ return prevJob.then(async (data) => { const response = await search({ index: [ - indices.errors, - indices.spans, - indices.metrics, - indices.transactions, + indices.error, + indices.span, + indices.metric, + indices.transaction, ], body: { size: 0, @@ -598,7 +598,7 @@ export const tasks: TelemetryTask[] = [ name: 'versions', executor: async ({ search, indices }) => { const response = await search({ - index: [indices.transactions, indices.spans, indices.errors], + index: [indices.transaction, indices.span, indices.error], terminateAfter: 1, body: { query: { @@ -643,7 +643,7 @@ export const tasks: TelemetryTask[] = [ executor: async ({ search, indices }) => { const errorGroupsCount = ( await search({ - index: indices.errors, + index: indices.error, body: { size: 0, timeout, @@ -679,7 +679,7 @@ export const tasks: TelemetryTask[] = [ const transactionGroupsCount = ( await search({ - index: indices.transactions, + index: indices.transaction, body: { size: 0, timeout, @@ -715,7 +715,7 @@ export const tasks: TelemetryTask[] = [ const tracesPerDayCount = ( await search({ - index: indices.transactions, + index: indices.transaction, body: { query: { bool: { @@ -737,7 +737,7 @@ export const tasks: TelemetryTask[] = [ const servicesCount = ( await search({ - index: [indices.transactions, indices.errors, indices.metrics], + index: [indices.transaction, indices.error, indices.metric], body: { size: 0, timeout, @@ -803,7 +803,7 @@ export const tasks: TelemetryTask[] = [ const data = await prevJob; const response = await search({ - index: [indices.errors, indices.metrics, indices.transactions], + index: [indices.error, indices.metric, indices.transaction], body: { size: 0, timeout, @@ -994,12 +994,12 @@ export const tasks: TelemetryTask[] = [ const response = await indicesStats({ index: [ indices.apmAgentConfigurationIndex, - indices.errors, - indices.metrics, + indices.error, + indices.metric, indices.onboarding, - indices.sourcemaps, - indices.spans, - indices.transactions, + indices.sourcemap, + indices.span, + indices.transaction, ], }); diff --git a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts index 942dd75482dbf..871df10d9bafa 100644 --- a/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts +++ b/x-pack/plugins/apm/server/lib/errors/distribution/get_buckets.test.ts @@ -43,12 +43,12 @@ describe('get buckets', () => { } ) as APMConfig, indices: { - sourcemaps: 'apm-*', - errors: 'apm-*', + sourcemap: 'apm-*', + error: 'apm-*', onboarding: 'apm-*', - spans: 'apm-*', - transactions: 'apm-*', - metrics: 'apm-*', + span: 'apm-*', + transaction: 'apm-*', + metric: 'apm-*', apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', }, diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts index 00321c727ffb3..5ef3786e9bde4 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.test.ts @@ -18,12 +18,12 @@ describe('unpackProcessorEvents', () => { } as APMEventESSearchRequest; const indices = { - transactions: 'my-apm-*-transaction-*', - metrics: 'my-apm-*-metric-*', - errors: 'my-apm-*-error-*', - spans: 'my-apm-*-span-*', + transaction: 'my-apm-*-transaction-*', + metric: 'my-apm-*-metric-*', + error: 'my-apm-*-error-*', + span: 'my-apm-*-span-*', onboarding: 'my-apm-*-onboarding-*', - sourcemaps: 'my-apm-*-sourcemap-*', + sourcemap: 'my-apm-*-sourcemap-*', } as ApmIndicesConfig; res = unpackProcessorEvents(request, indices); diff --git a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts index 5d9f38f7dd8d4..582fe0374c5ca 100644 --- a/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts +++ b/x-pack/plugins/apm/server/lib/helpers/create_es_client/create_apm_event_client/unpack_processor_events.ts @@ -16,12 +16,12 @@ import { APMEventESSearchRequest, APMEventESTermsEnumRequest } from '.'; import { ApmIndicesConfig } from '../../../settings/apm_indices/get_apm_indices'; const processorEventIndexMap = { - [ProcessorEvent.transaction]: 'transactions', - [ProcessorEvent.span]: 'spans', - [ProcessorEvent.metric]: 'metrics', - [ProcessorEvent.error]: 'errors', + [ProcessorEvent.transaction]: 'transaction', + [ProcessorEvent.span]: 'span', + [ProcessorEvent.metric]: 'metric', + [ProcessorEvent.error]: 'error', // TODO: should have its own config setting - [ProcessorEvent.profile]: 'transactions', + [ProcessorEvent.profile]: 'transaction', } as const; export function unpackProcessorEvents( diff --git a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts index 2fa4f58b8a441..d5ff97c050d9d 100644 --- a/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts +++ b/x-pack/plugins/apm/server/lib/helpers/setup_request.test.ts @@ -10,17 +10,20 @@ import { APMConfig } from '../..'; import { APMRouteHandlerResources } from '../../routes/typings'; import { ProcessorEvent } from '../../../common/processor_event'; import { PROCESSOR_EVENT } from '../../../common/elasticsearch_fieldnames'; +import { getApmIndices } from '../settings/apm_indices/get_apm_indices'; +import { PromiseReturnType } from '../../../../observability/typings/common'; jest.mock('../settings/apm_indices/get_apm_indices', () => ({ - getApmIndices: async () => ({ - sourcemaps: 'apm-*', - errors: 'apm-*', - onboarding: 'apm-*', - spans: 'apm-*', - transactions: 'apm-*', - metrics: 'apm-*', - apmAgentConfigurationIndex: 'apm-*', - }), + getApmIndices: async () => + ({ + sourcemap: 'apm-*', + error: 'apm-*', + onboarding: 'apm-*', + span: 'apm-*', + transaction: 'apm-*', + metric: 'apm-*', + apmAgentConfigurationIndex: 'apm-*', + } as PromiseReturnType), })); jest.mock('../index_pattern/get_dynamic_index_pattern', () => ({ diff --git a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts index 9def9f12568d2..83adab6ae6cbc 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/create_static_index_pattern.test.ts @@ -24,11 +24,11 @@ function getMockSavedObjectsClient(existingIndexPatternTitle: string) { const setup = { indices: { - transactions: 'apm-*-transaction-*', - spans: 'apm-*-span-*', - errors: 'apm-*-error-*', - metrics: 'apm-*-metrics-*', - }, + transaction: 'apm-*-transaction-*', + span: 'apm-*-span-*', + error: 'apm-*-error-*', + metric: 'apm-*-metrics-*', + } as APMConfig['indices'], } as unknown as Setup; describe('createStaticIndexPattern', () => { diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts index f98eed5c5e305..8b7444ffdf6fa 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.test.ts @@ -11,10 +11,10 @@ import { getApmIndexPatternTitle } from './get_apm_index_pattern_title'; describe('getApmIndexPatternTitle', () => { it('returns an index pattern title by combining existing indicies', () => { const title = getApmIndexPatternTitle({ - transactions: 'apm-*-transaction-*', - spans: 'apm-*-span-*', - errors: 'apm-*-error-*', - metrics: 'apm-*-metrics-*', + transaction: 'apm-*-transaction-*', + span: 'apm-*-span-*', + error: 'apm-*-error-*', + metric: 'apm-*-metrics-*', } as ApmIndicesConfig); expect(title).toBe( 'apm-*-transaction-*,apm-*-span-*,apm-*-error-*,apm-*-metrics-*' @@ -23,10 +23,10 @@ describe('getApmIndexPatternTitle', () => { it('removes duplicates', () => { const title = getApmIndexPatternTitle({ - transactions: 'apm-*', - spans: 'apm-*', - errors: 'apm-*', - metrics: 'apm-*', + transaction: 'apm-*', + span: 'apm-*', + error: 'apm-*', + metric: 'apm-*', } as ApmIndicesConfig); expect(title).toBe('apm-*'); }); diff --git a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts index df67930f56419..5e055ff1c2fdc 100644 --- a/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts +++ b/x-pack/plugins/apm/server/lib/index_pattern/get_apm_index_pattern_title.ts @@ -10,9 +10,9 @@ import { ApmIndicesConfig } from '../settings/apm_indices/get_apm_indices'; export function getApmIndexPatternTitle(apmIndicesConfig: ApmIndicesConfig) { return uniq([ - apmIndicesConfig.transactions, - apmIndicesConfig.spans, - apmIndicesConfig.errors, - apmIndicesConfig.metrics, + apmIndicesConfig.transaction, + apmIndicesConfig.span, + apmIndicesConfig.error, + apmIndicesConfig.metric, ]).join(','); } diff --git a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts index 092eddaedf123..ba35ac5c5c89c 100644 --- a/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts +++ b/x-pack/plugins/apm/server/lib/rum_client/has_rum_data.ts @@ -56,7 +56,7 @@ export async function hasRumData({ const response = await apmEventClient.search('has_rum_data', params); return { - indices: setup.indices.transactions, + indices: setup.indices.transaction, hasData: response.hits.total.value > 0, serviceName: response.aggregations?.services?.mostTraffic?.buckets?.[0]?.key, @@ -65,7 +65,7 @@ export async function hasRumData({ return { hasData: false, serviceName: undefined, - indices: setup.indices.transactions, + indices: setup.indices.transaction, }; } } diff --git a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts index 876d3c14eea04..239cf39f15ffe 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/failed_transactions_correlations/failed_transactions_correlations_search_service.ts @@ -65,7 +65,7 @@ export const failedTransactionsCorrelationsSearchServiceProvider: FailedTransact const params: FailedTransactionsCorrelationsRequestParams & SearchStrategyServerParams = { ...searchServiceParams, - index: indices.transactions, + index: indices.transaction, includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts index f7d0e6dca0e2a..91f4a0d3349a4 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/latency_correlations/latency_correlations_search_service.ts @@ -67,7 +67,7 @@ export const latencyCorrelationsSearchServiceProvider: LatencyCorrelationsSearch const indices = await getApmIndices(); params = { ...searchServiceParams, - index: indices.transactions, + index: indices.transaction, includeFrozen, }; diff --git a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts index b2bea57a913cc..8a9d04df32036 100644 --- a/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts +++ b/x-pack/plugins/apm/server/lib/search_strategies/search_strategy_provider.test.ts @@ -90,7 +90,7 @@ const clientSearchMock = ( }; const getApmIndicesMock = async () => - ({ transactions: 'apm-*' } as ApmIndicesConfig); + ({ transaction: 'apm-*' } as ApmIndicesConfig); describe('APM Correlations search strategy', () => { describe('strategy interface', () => { diff --git a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts index 2e75aec69a3fb..107493af1a0c0 100644 --- a/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts +++ b/x-pack/plugins/apm/server/lib/settings/apm_indices/get_apm_indices.ts @@ -34,12 +34,12 @@ async function getApmIndicesSavedObject( export function getApmIndicesConfig(config: APMConfig): ApmIndicesConfig { return { - sourcemaps: config.indices.sourcemaps, - errors: config.indices.errors, + sourcemap: config.indices.sourcemap, + error: config.indices.error, onboarding: config.indices.onboarding, - spans: config.indices.spans, - transactions: config.indices.transactions, - metrics: config.indices.metrics, + span: config.indices.span, + transaction: config.indices.transaction, + metric: config.indices.metric, // system indices, not configurable apmAgentConfigurationIndex: '.apm-agent-configuration', apmCustomLinkIndex: '.apm-custom-link', diff --git a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts index 7c4543cf3eda3..76cabd3e3af93 100644 --- a/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts +++ b/x-pack/plugins/apm/server/lib/transactions/breakdown/index.test.ts @@ -11,14 +11,15 @@ import noDataResponse from './mock_responses/no_data.json'; import dataResponse from './mock_responses/data.json'; import { APMConfig } from '../../..'; import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values'; +import { ApmIndicesConfig } from '../../settings/apm_indices/get_apm_indices'; -const mockIndices = { - sourcemaps: 'myIndex', - errors: 'myIndex', +const mockIndices: ApmIndicesConfig = { + sourcemap: 'myIndex', + error: 'myIndex', onboarding: 'myIndex', - spans: 'myIndex', - transactions: 'myIndex', - metrics: 'myIndex', + span: 'myIndex', + transaction: 'myIndex', + metric: 'myIndex', apmAgentConfigurationIndex: 'myIndex', apmCustomLinkIndex: 'myIndex', }; diff --git a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts index 04414c019a989..156f4d1af0bb2 100644 --- a/x-pack/plugins/apm/server/routes/settings/apm_indices.ts +++ b/x-pack/plugins/apm/server/routes/settings/apm_indices.ts @@ -13,6 +13,7 @@ import { getApmIndexSettings, } from '../../lib/settings/apm_indices/get_apm_indices'; import { saveApmIndices } from '../../lib/settings/apm_indices/save_apm_indices'; +import { APMConfig } from '../..'; // get list of apm indices and values const apmIndexSettingsRoute = createApmServerRoute({ @@ -37,6 +38,10 @@ const apmIndicesRoute = createApmServerRoute({ }, }); +type SaveApmIndicesBodySchema = { + [Property in keyof APMConfig['indices']]: t.StringC; +}; + // save ui indices const saveApmIndicesRoute = createApmServerRoute({ endpoint: 'POST /internal/apm/settings/apm-indices/save', @@ -45,13 +50,13 @@ const saveApmIndicesRoute = createApmServerRoute({ }, params: t.type({ body: t.partial({ - sourcemaps: t.string, - errors: t.string, + sourcemap: t.string, + error: t.string, onboarding: t.string, - spans: t.string, - transactions: t.string, - metrics: t.string, - }), + span: t.string, + transaction: t.string, + metric: t.string, + } as SaveApmIndicesBodySchema), }), handler: async (resources) => { const { params, context } = resources; diff --git a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts index 0be512a4fd17f..4aa6c4953056a 100644 --- a/x-pack/plugins/apm/server/saved_objects/apm_indices.ts +++ b/x-pack/plugins/apm/server/saved_objects/apm_indices.ts @@ -8,21 +8,23 @@ import { SavedObjectsType } from 'src/core/server'; import { i18n } from '@kbn/i18n'; import { updateApmOssIndexPaths } from './migrations/update_apm_oss_index_paths'; +import { ApmIndicesConfigName } from '..'; + +const properties: { [Property in ApmIndicesConfigName]: { type: 'keyword' } } = + { + sourcemap: { type: 'keyword' }, + error: { type: 'keyword' }, + onboarding: { type: 'keyword' }, + span: { type: 'keyword' }, + transaction: { type: 'keyword' }, + metric: { type: 'keyword' }, + }; export const apmIndices: SavedObjectsType = { name: 'apm-indices', hidden: false, namespaceType: 'agnostic', - mappings: { - properties: { - sourcemaps: { type: 'keyword' }, - errors: { type: 'keyword' }, - onboarding: { type: 'keyword' }, - spans: { type: 'keyword' }, - transactions: { type: 'keyword' }, - metrics: { type: 'keyword' }, - }, - }, + mappings: { properties }, management: { importableAndExportable: true, icon: 'apmApp', diff --git a/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts index 49ea9076b0087..72ba40db0ce05 100644 --- a/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts +++ b/x-pack/plugins/apm/server/saved_objects/migrations/update_apm_oss_index_paths.ts @@ -6,12 +6,12 @@ */ const apmIndexConfigs = [ - ['sourcemaps', 'apm_oss.sourcemapIndices'], - ['errors', 'apm_oss.errorIndices'], + ['sourcemap', 'apm_oss.sourcemapIndices'], + ['error', 'apm_oss.errorIndices'], ['onboarding', 'apm_oss.onboardingIndices'], - ['spans', 'apm_oss.spanIndices'], - ['transactions', 'apm_oss.transactionIndices'], - ['metrics', 'apm_oss.metricsIndices'], + ['span', 'apm_oss.spanIndices'], + ['transaction', 'apm_oss.transactionIndices'], + ['metric', 'apm_oss.metricsIndices'], ] as const; type ApmIndexConfigs = typeof apmIndexConfigs[number][0]; diff --git a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index 4d617e6a47e42..157471b39a8e8 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -231,9 +231,9 @@ export function onPremInstructions({ ), esHitsCheck: { index: [ - apmConfig.indices.errors, - apmConfig.indices.transactions, - apmConfig.indices.metrics, + apmConfig.indices.error, + apmConfig.indices.transaction, + apmConfig.indices.metric, ], query: { bool: { diff --git a/x-pack/plugins/apm/server/utils/test_helpers.tsx b/x-pack/plugins/apm/server/utils/test_helpers.tsx index 68447f4ad7928..5cf5016aec2e9 100644 --- a/x-pack/plugins/apm/server/utils/test_helpers.tsx +++ b/x-pack/plugins/apm/server/utils/test_helpers.tsx @@ -12,6 +12,7 @@ import { ESSearchResponse, } from '../../../../../src/core/types/elasticsearch'; import { UxUIFilters } from '../../typings/ui_filters'; +import { ApmIndicesConfig } from '../lib/settings/apm_indices/get_apm_indices'; interface Options { mockResponse?: ( @@ -26,16 +27,7 @@ interface MockSetup { internalClient: any; config: APMConfig; uiFilters: UxUIFilters; - indices: { - sourcemaps: string; - errors: string; - onboarding: string; - spans: string; - transactions: string; - metrics: string; - apmAgentConfigurationIndex: string; - apmCustomLinkIndex: string; - }; + indices: ApmIndicesConfig; } export async function inspectSearchParams( @@ -59,13 +51,15 @@ export async function inspectSearchParams( let response; let error; - const mockApmIndices = { - sourcemaps: 'myIndex', - errors: 'myIndex', + const mockApmIndices: { + [Property in keyof APMConfig['indices']]: string; + } = { + sourcemap: 'myIndex', + error: 'myIndex', onboarding: 'myIndex', - spans: 'myIndex', - transactions: 'myIndex', - metrics: 'myIndex', + span: 'myIndex', + transaction: 'myIndex', + metric: 'myIndex', }; const mockSetup = { apmEventClient: { search: spy } as any, diff --git a/x-pack/plugins/observability/common/typings.ts b/x-pack/plugins/observability/common/typings.ts index b9edb51760a32..bccb0f4491009 100644 --- a/x-pack/plugins/observability/common/typings.ts +++ b/x-pack/plugins/observability/common/typings.ts @@ -16,12 +16,12 @@ export const alertWorkflowStatusRt = t.keyof({ export type AlertWorkflowStatus = t.TypeOf; export interface ApmIndicesConfig { - sourcemaps: string; - errors: string; + sourcemap: string; + error: string; onboarding: string; - spans: string; - transactions: string; - metrics: string; + span: string; + transaction: string; + metric: string; apmAgentConfigurationIndex: string; apmCustomLinkIndex: string; } diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx index 36dcd93b7d7ee..8a766075ef8d2 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/hooks/use_app_index_pattern.tsx @@ -65,7 +65,7 @@ export function IndexPatternContextProvider({ children }: ProviderProps) { case 'mobile': const resultApm = await getDataHandler('apm')?.hasData(); hasDataT = Boolean(resultApm?.hasData); - indices = resultApm?.indices.transactions; + indices = resultApm?.indices.transaction; break; } setHasAppData((prevState) => ({ ...prevState, [dataType]: hasDataT })); diff --git a/x-pack/plugins/observability/public/context/has_data_context.test.tsx b/x-pack/plugins/observability/public/context/has_data_context.test.tsx index 72cfe68a583ef..a586a8bf0bcce 100644 --- a/x-pack/plugins/observability/public/context/has_data_context.test.tsx +++ b/x-pack/plugins/observability/public/context/has_data_context.test.tsx @@ -24,7 +24,7 @@ import { act } from '@testing-library/react'; const relativeStart = '2020-10-08T06:00:00.000Z'; const relativeEnd = '2020-10-08T07:00:00.000Z'; -const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transaction: 'apm-*' } as ApmIndicesConfig; function wrapper({ children }: { children: React.ReactElement }) { const history = createMemoryHistory(); diff --git a/x-pack/plugins/observability/public/data_handler.test.ts b/x-pack/plugins/observability/public/data_handler.test.ts index 127b00349d43f..2beae5d111f7d 100644 --- a/x-pack/plugins/observability/public/data_handler.test.ts +++ b/x-pack/plugins/observability/public/data_handler.test.ts @@ -9,7 +9,7 @@ import { registerDataHandler, getDataHandler } from './data_handler'; import moment from 'moment'; import { ApmIndicesConfig } from '../common/typings'; -const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transaction: 'apm-*' } as ApmIndicesConfig; const params = { absoluteTime: { diff --git a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx index 8eded3fad7dac..506b919b16416 100644 --- a/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx +++ b/x-pack/plugins/observability/public/pages/overview/overview.stories.tsx @@ -36,7 +36,7 @@ function unregisterAll() { unregisterDataHandler({ appName: 'synthetics' }); } -const sampleAPMIndices = { transactions: 'apm-*' } as ApmIndicesConfig; +const sampleAPMIndices = { transaction: 'apm-*' } as ApmIndicesConfig; const withCore = makeDecorator({ name: 'withCore',