Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APM] Removes the apm_oss plugin and deprecates related configs #113364

Merged
merged 26 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af64ec4
[APM] Removes the apm_oss plugin and deprecates related configs (#108…
ogupte Sep 29, 2021
7483967
removes commented lines
ogupte Sep 29, 2021
1c191a6
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 1, 2021
d8d6a4e
fixes typescript errors
ogupte Oct 1, 2021
a5d2013
performs start up migration on the saved objects mapping for apm-indices
ogupte Oct 1, 2021
b763ccd
removes all references to the deprecated apm_oss.* config paths in APM
ogupte Oct 1, 2021
2925f27
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 2, 2021
dd4452d
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 4, 2021
3f99b3b
fixes missing bundle error
ogupte Oct 4, 2021
e962bff
fixes type error
ogupte Oct 4, 2021
ed2a100
fixes eslint error with disabled rules
ogupte Oct 4, 2021
52b9da0
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 4, 2021
96ca96b
fixes saved object mappings for es_archvices for tests
ogupte Oct 4, 2021
2f0ac0b
fixes eslint error
ogupte Oct 5, 2021
06d401c
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 6, 2021
66953af
Updates default index values to include the more general apm-*. Fixes…
ogupte Oct 7, 2021
82aa5b0
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 7, 2021
0122390
removing unused configs from the config path migration: apm_oss.index…
ogupte Oct 7, 2021
cbb5944
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 7, 2021
72c4e18
- replaces full index configuration paths with references in the `xpa…
ogupte Oct 12, 2021
45814dc
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 12, 2021
d9d27b8
fixes proxy mock object in unit test
ogupte Oct 12, 2021
7965f99
fixes linting issues
ogupte Oct 12, 2021
e79e90f
PR feedback and failed test
ogupte Oct 12, 2021
2812cca
changes the configs at `xpack.apm.indices.*` from plural to singular …
ogupte Oct 13, 2021
57d955d
Merge branch 'master' into apm-109104-hardcoded-data-streams
ogupte Oct 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/plugins/apm_oss/README.asciidoc

This file was deleted.

13 changes: 0 additions & 13 deletions src/plugins/apm_oss/kibana.json

This file was deleted.

16 changes: 0 additions & 16 deletions src/plugins/apm_oss/public/index.ts

This file was deleted.

22 changes: 0 additions & 22 deletions src/plugins/apm_oss/public/plugin.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/plugins/apm_oss/public/types.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/plugins/apm_oss/server/index.ts

This file was deleted.

30 changes: 0 additions & 30 deletions src/plugins/apm_oss/server/plugin.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/plugins/apm_oss/tsconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugins/apm/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"version": "8.0.0",
"kibanaVersion": "kibana",
"requiredPlugins": [
"apmOss",
"data",
"embeddable",
"features",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}),
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function Wrapper({ children }: { children?: ReactNode }) {
);
}

// TODO
ogupte marked this conversation as resolved.
Show resolved Hide resolved
describe('Settings', () => {
it('renders', async () => {
const routerProps = {
Expand Down
8 changes: 2 additions & 6 deletions x-pack/plugins/apm/server/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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-*',
ogupte marked this conversation as resolved.
Show resolved Hide resolved
'apm_oss.metricsIndices': 'metrics-apm*,apm-*-metric-*',
'apm_oss.spanIndices': 'traces-apm*,apm-*-span-*',
Expand Down
76 changes: 47 additions & 29 deletions x-pack/plugins/apm/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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-*' }),
sorenlouv marked this conversation as resolved.
Show resolved Hide resolved
fleetMode: schema.boolean({ defaultValue: true }),
});

// plugin config
export const config: PluginConfigDescriptor<APMXPackConfig> = {
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'),
sorenlouv marked this conversation as resolved.
Show resolved Hide resolved
],
exposeToBrowser: {
serviceMapEnabled: true,
ui: true,
Expand All @@ -65,19 +97,22 @@ export type APMXPackConfig = TypeOf<typeof configSchema>;
export type APMConfig = ReturnType<typeof mergeConfigs>;

// 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':
Expand Down Expand Up @@ -105,23 +140,6 @@ 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']}`;

return mergedConfig;
}
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-*',
ogupte marked this conversation as resolved.
Show resolved Hide resolved
'apm_oss.errorIndices': 'my-apm-*-error-*',
Expand Down
Loading