[APM] Remove infrastructure feature flag from kibana advance settings (#138892)

* Remove infrastructure feature flag from advance settings

* add setting migration to remove it from existing config

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Miriam 2022-08-18 16:24:02 +01:00 committed by GitHub
parent 477bba2d05
commit ad135e9610
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 57 additions and 99 deletions

View file

@ -310,3 +310,38 @@ describe('ui_settings 8.1.0 migrations', () => {
});
});
});
describe('ui_settings 8.5.0 migrations', () => {
const migration = migrations['8.5.0'];
test('returns doc on empty object', () => {
expect(migration({} as SavedObjectUnsanitizedDoc)).toEqual({
references: [],
});
});
test('removes "observability:enableInfrastructureView" setting', () => {
const doc = {
type: 'config',
id: '8.5.0',
attributes: {
buildNum: 9007199254740991,
'observability:enableInfrastructureView': true,
},
references: [],
updated_at: '2020-06-09T20:18:20.349Z',
migrationVersion: {},
};
expect(migration(doc)).toEqual({
type: 'config',
id: '8.5.0',
attributes: {
buildNum: 9007199254740991,
},
references: [],
updated_at: '2020-06-09T20:18:20.349Z',
migrationVersion: {},
});
});
});

View file

@ -138,4 +138,25 @@ export const migrations = {
}),
references: doc.references || [],
}),
'8.5.0': (doc: SavedObjectUnsanitizedDoc<any>): SavedObjectSanitizedDoc<any> => ({
...doc,
...(doc.attributes && {
attributes: Object.keys(doc.attributes).reduce(
(acc, key) =>
[
// owner: Team:Apm
'observability:enableInfrastructureView',
].includes(key)
? {
...acc,
}
: {
...acc,
[key]: doc.attributes[key],
},
{}
),
}),
references: doc.references || [],
}),
};

View file

@ -430,10 +430,6 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableServiceGroups': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },

View file

@ -41,7 +41,6 @@ export interface UsageStats {
'observability:enableNewSyntheticsView': boolean;
'observability:maxSuggestions': number;
'observability:enableComparisonByDefault': boolean;
'observability:enableInfrastructureView': boolean;
'observability:enableServiceGroups': boolean;
'visualize:enableLabs': boolean;
'visualization:heatmap:maxBuckets': number;

View file

@ -8282,12 +8282,6 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureView": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"observability:enableServiceGroups": {
"type": "boolean",
"_meta": {

View file

@ -1,61 +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 { synthtrace } from '../../../../synthtrace';
import { opbeans } from '../../../fixtures/synthtrace/opbeans';
const serviceOverviewPath = '/app/apm/services/opbeans-python/overview';
const start = '2021-10-10T00:00:00.000Z';
const end = '2021-10-10T00:15:00.000Z';
describe('Infrastracture feature flag', () => {
before(async () => {
await synthtrace.index(
opbeans({
from: new Date(start).getTime(),
to: new Date(end).getTime(),
})
);
});
after(async () => {
await synthtrace.clean();
});
describe('when infrastracture feature is enabled', () => {
beforeEach(() => {
cy.loginAsEditorUser().then(() => {
// enables infrastructure view feature on advanced settings
cy.updateAdvancedSettings({
'observability:enableInfrastructureView': true,
});
});
});
it('shows infrastructure tab in service overview page', () => {
cy.visit(serviceOverviewPath);
cy.contains('a[role="tab"]', 'Infrastructure');
});
});
describe('when infrastracture feature is disabled', () => {
beforeEach(() => {
cy.loginAsEditorUser().then(() => {
// enables infrastructure view feature on advanced settings
cy.updateAdvancedSettings({
'observability:enableInfrastructureView': false,
});
});
});
it('hides infrastructure tab in service overview page', () => {
cy.visit(serviceOverviewPath);
cy.contains('a[role="tab"]', 'Infrastructure').should('not.exist');
});
});
});

View file

@ -14,7 +14,6 @@ import {
import { i18n } from '@kbn/i18n';
import { omit } from 'lodash';
import React from 'react';
import { enableInfrastructureView } from '@kbn/observability-plugin/public';
import {
isMobileAgentName,
isJavaAgentName,
@ -177,8 +176,6 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
capabilities
);
const showInfraTab = core.uiSettings.get<boolean>(enableInfrastructureView);
const router = useApmRouter();
const {
@ -269,8 +266,6 @@ function useTabs({ selectedTab }: { selectedTab: Tab['key'] }) {
label: i18n.translate('xpack.apm.home.infraTabLabel', {
defaultMessage: 'Infrastructure',
}),
hidden: !showInfraTab,
},
{
key: 'service-map',

View file

@ -15,7 +15,6 @@ export {
enableInspectEsQueries,
maxSuggestions,
enableComparisonByDefault,
enableInfrastructureView,
defaultApmServiceEnvironment,
apmServiceInventoryOptimizedSorting,
apmProgressiveLoading,

View file

@ -9,7 +9,6 @@ export const enableNewSyntheticsView = 'observability:enableNewSyntheticsView';
export const enableInspectEsQueries = 'observability:enableInspectEsQueries';
export const maxSuggestions = 'observability:maxSuggestions';
export const enableComparisonByDefault = 'observability:enableComparisonByDefault';
export const enableInfrastructureView = 'observability:enableInfrastructureView';
export const defaultApmServiceEnvironment = 'observability:apmDefaultServiceEnvironment';
export const apmProgressiveLoading = 'observability:apmProgressiveLoading';
export const enableServiceGroups = 'observability:enableServiceGroups';

View file

@ -27,7 +27,6 @@ export type {
export {
enableInspectEsQueries,
enableComparisonByDefault,
enableInfrastructureView,
enableServiceGroups,
enableNewSyntheticsView,
apmServiceGroupMaxNumberOfServices,

View file

@ -13,7 +13,6 @@ import {
enableComparisonByDefault,
enableInspectEsQueries,
maxSuggestions,
enableInfrastructureView,
defaultApmServiceEnvironment,
apmProgressiveLoading,
enableServiceGroups,
@ -84,17 +83,6 @@ export const uiSettings: Record<string, UiSettingsParams<boolean | number | stri
}),
schema: schema.boolean(),
},
[enableInfrastructureView]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.enableInfrastructureView', {
defaultMessage: 'Infrastructure feature',
}),
value: true,
description: i18n.translate('xpack.observability.enableInfrastructureViewDescription', {
defaultMessage: 'Enable the Infrastructure view feature in APM app',
}),
schema: schema.boolean(),
},
[defaultApmServiceEnvironment]: {
category: [observabilityFeatureId],
sensitive: true,

View file

@ -23273,9 +23273,7 @@
"xpack.observability.emptySection.apps.ux.link": "Installer RUM Agent",
"xpack.observability.emptySection.apps.ux.title": "Expérience utilisateur",
"xpack.observability.enableComparisonByDefault": "Fonctionnalité de comparaison",
"xpack.observability.enableComparisonByDefaultDescription": "Activer la fonctionnalité de comparaison dans lapplication APM",
"xpack.observability.enableInfrastructureView": "Fonctionnalité d'infrastructure",
"xpack.observability.enableInfrastructureViewDescription": "Activer la fonctionnalité de vue d'infrastructure dans l'application APM",
"xpack.observability.enableComparisonByDefaultDescription": "Activer la fonctionnalité de comparaison dans lapplication APM",
"xpack.observability.enableInspectEsQueriesExperimentDescription": "Inspectez les recherches Elasticsearch dans les réponses API.",
"xpack.observability.enableInspectEsQueriesExperimentName": "Inspecter les recherches ES",
"xpack.observability.enableNewSyntheticsViewExperimentDescription": "Activez la nouvelle application de monitoring synthétique dans Observability. Actualisez la page pour appliquer le paramètre.",

View file

@ -23255,8 +23255,6 @@
"xpack.observability.emptySection.apps.ux.title": "ユーザーエクスペリエンス",
"xpack.observability.enableComparisonByDefault": "比較機能",
"xpack.observability.enableComparisonByDefaultDescription": "APMアプリで比較機能を有効にする",
"xpack.observability.enableInfrastructureView": "インフラストラクチャ機能",
"xpack.observability.enableInfrastructureViewDescription": "APMアプリでインフラストラクチャビュー機能を有効にする",
"xpack.observability.enableInspectEsQueriesExperimentDescription": "API応答でElasticsearchクエリを調査します。",
"xpack.observability.enableInspectEsQueriesExperimentName": "ESクエリを調査",
"xpack.observability.enableNewSyntheticsViewExperimentDescription": "オブザーバビリティで新しい合成監視アプリケーションを有効にします。設定を適用するにはページを更新してください。",

View file

@ -23283,8 +23283,6 @@
"xpack.observability.emptySection.apps.ux.title": "用户体验",
"xpack.observability.enableComparisonByDefault": "对比功能",
"xpack.observability.enableComparisonByDefaultDescription": "在 APM 应用中启用对比功能",
"xpack.observability.enableInfrastructureView": "基础架构功能",
"xpack.observability.enableInfrastructureViewDescription": "在 APM 应用中启用基础架构视图功能",
"xpack.observability.enableInspectEsQueriesExperimentDescription": "检查 API 响应中的 Elasticsearch 查询。",
"xpack.observability.enableInspectEsQueriesExperimentName": "检查 ES 查询",
"xpack.observability.enableNewSyntheticsViewExperimentDescription": "在 Observability 中启用新的组合监测应用程序。刷新页面可应用该设置。",