Skip to content

Commit

Permalink
[Synthetics] Hide behind feature flag (#131502)
Browse files Browse the repository at this point in the history
Co-authored-by: Colleen McGinnis <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
3 people authored May 6, 2022
1 parent 741d7e9 commit 3d94789
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableNewSyntheticsView': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:maxSuggestions': {
type: 'integer',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface UsageStats {
'discover:maxDocFieldsDisplayed': number;
'securitySolution:rulesTableRefresh': string;
'observability:enableInspectEsQueries': boolean;
'observability:enableNewSyntheticsView': boolean;
'observability:maxSuggestions': number;
'observability:enableComparisonByDefault': boolean;
'observability:enableInfrastructureView': boolean;
Expand Down
26 changes: 16 additions & 10 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,29 +202,29 @@
}
}
},
"search": {
"search-session": {
"properties": {
"successCount": {
"transientCount": {
"type": "long"
},
"errorCount": {
"persistedCount": {
"type": "long"
},
"averageDuration": {
"type": "float"
"totalCount": {
"type": "long"
}
}
},
"search-session": {
"search": {
"properties": {
"transientCount": {
"successCount": {
"type": "long"
},
"persistedCount": {
"errorCount": {
"type": "long"
},
"totalCount": {
"type": "long"
"averageDuration": {
"type": "float"
}
}
},
Expand Down Expand Up @@ -8133,6 +8133,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableNewSyntheticsView": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"observability:maxSuggestions": {
"type": "integer",
"_meta": {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/common/ui_settings_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

export const enableNewSyntheticsView = 'observability:enableNewSyntheticsView';
export const enableInspectEsQueries = 'observability:enableInspectEsQueries';
export const maxSuggestions = 'observability:maxSuggestions';
export const enableComparisonByDefault = 'observability:enableComparisonByDefault';
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export {
enableComparisonByDefault,
enableInfrastructureView,
enableServiceGroups,
enableNewSyntheticsView,
} from '../common/ui_settings_keys';
export { uptimeOverviewLocatorID } from '../common';

Expand Down
19 changes: 18 additions & 1 deletion x-pack/plugins/observability/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
apmProgressiveLoading,
enableServiceGroups,
apmServiceInventoryOptimizedSorting,
enableNewSyntheticsView,
} from '../common/ui_settings_keys';

const technicalPreviewLabel = i18n.translate(
Expand All @@ -31,6 +32,22 @@ const technicalPreviewLabel = i18n.translate(
* uiSettings definitions for Observability.
*/
export const uiSettings: Record<string, UiSettingsParams<boolean | number | string>> = {
[enableNewSyntheticsView]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.enableNewSyntheticsViewExperimentName', {
defaultMessage: 'Enable new synthetic monitoring application',
}),
value: false,
description: i18n.translate(
'xpack.observability.enableNewSyntheticsViewExperimentDescription',
{
defaultMessage:
'Enable new synthetic monitoring application in observability. Refresh the page to apply the setting.',
}
),
schema: schema.boolean(),
requiresPageReload: true,
},
[enableInspectEsQueries]: {
category: [observabilityFeatureId],
name: i18n.translate('xpack.observability.enableInspectEsQueriesExperimentName', {
Expand Down Expand Up @@ -71,7 +88,7 @@ export const uiSettings: Record<string, UiSettingsParams<boolean | number | stri
}),
value: false,
description: i18n.translate('xpack.observability.enableInfrastructureViewDescription', {
defaultMessage: 'Enable the Infrastruture view feature in APM app',
defaultMessage: 'Enable the Infrastructure view feature in APM app',
}),
schema: schema.boolean(),
},
Expand Down
35 changes: 20 additions & 15 deletions x-pack/plugins/synthetics/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/p

import { FleetStart } from '@kbn/fleet-plugin/public';
import {
enableNewSyntheticsView,
FetchDataParams,
ObservabilityPublicSetup,
ObservabilityPublicStart,
Expand Down Expand Up @@ -192,22 +193,26 @@ export class UptimePlugin
},
});

// Register the Synthetics UI plugin
core.application.register({
id: 'synthetics',
euiIconType: 'logoObservability',
order: 8400,
title: PLUGIN.SYNTHETICS,
category: DEFAULT_APP_CATEGORIES.observability,
keywords: appKeywords,
deepLinks: [],
mount: async (params: AppMountParameters) => {
const [coreStart, corePlugins] = await core.getStartServices();
const isSyntheticsViewEnabled = core.uiSettings.get<boolean>(enableNewSyntheticsView);

const { renderApp } = await import('./apps/synthetics/render_app');
return renderApp(coreStart, plugins, corePlugins, params, this.initContext.env.mode.dev);
},
});
if (isSyntheticsViewEnabled) {
// Register the Synthetics UI plugin
core.application.register({
id: 'synthetics',
euiIconType: 'logoObservability',
order: 8400,
title: PLUGIN.SYNTHETICS,
category: DEFAULT_APP_CATEGORIES.observability,
keywords: appKeywords,
deepLinks: [],
mount: async (params: AppMountParameters) => {
const [coreStart, corePlugins] = await core.getStartServices();

const { renderApp } = await import('./apps/synthetics/render_app');
return renderApp(coreStart, plugins, corePlugins, params, this.initContext.env.mode.dev);
},
});
}
}

public start(start: CoreStart, plugins: ClientPluginsStart): void {
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/functional/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default async function ({ readConfigFile }) {
'--xpack.encryptedSavedObjects.encryptionKey="DkdXazszSCYexXqz4YktBGHCRkV6hyNK"',
'--xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled=true',
'--savedObjects.maxImportPayloadBytes=10485760', // for OSS test management/_import_objects,
'--uiSettings.overrides.observability:enableNewSyntheticsView=true', // for OSS test management/_import_objects,
],
},
uiSettings: {
Expand Down

0 comments on commit 3d94789

Please sign in to comment.