diff --git a/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/serverless/oblt.serverless.config.ts b/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/serverless/oblt.serverless.config.ts index 0fa2de4c24127..bccc81bf2a6dc 100644 --- a/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/serverless/oblt.serverless.config.ts +++ b/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/serverless/oblt.serverless.config.ts @@ -23,7 +23,7 @@ export const servers: ScoutServerConfig = { ...defaultConfig.kbnTestServer, serverArgs: [ ...defaultConfig.kbnTestServer.serverArgs, - '--xpack.apm.featureFlags.serviceMapUseReactFlow=true', + '--feature_flags.overrides.apm.serviceMapUseReactFlow=true', ], }, }; diff --git a/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/stateful/stateful.config.ts b/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/stateful/stateful.config.ts index e36135d430113..9153257956573 100644 --- a/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/stateful/stateful.config.ts +++ b/src/platform/packages/shared/kbn-scout/src/servers/configs/custom/react_flow_service_map/stateful/stateful.config.ts @@ -23,7 +23,7 @@ export const servers: ScoutServerConfig = { ...defaultConfig.kbnTestServer, serverArgs: [ ...defaultConfig.kbnTestServer.serverArgs, - '--xpack.apm.featureFlags.serviceMapUseReactFlow=true', + '--feature_flags.overrides.apm.serviceMapUseReactFlow=true', ], }, }; diff --git a/src/platform/test/plugin_functional/test_suites/core_plugins/rendering.ts b/src/platform/test/plugin_functional/test_suites/core_plugins/rendering.ts index ed8152e0eedac..3e683bf985d98 100644 --- a/src/platform/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/src/platform/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -213,7 +213,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.apm.featureFlags.infrastructureTabAvailable (boolean?|true?)', 'xpack.apm.featureFlags.infraUiAvailable (boolean?|true?)', 'xpack.apm.featureFlags.migrationToFleetAvailable (boolean?|true?)', - 'xpack.apm.featureFlags.serviceMapUseReactFlow (boolean?)', 'xpack.apm.featureFlags.sourcemapApiAvailable (boolean?|true?)', 'xpack.apm.featureFlags.storageExplorerAvailable (boolean?|true?)', // to be removed in https://github.com/elastic/kibana/issues/221904 diff --git a/x-pack/solutions/observability/plugins/apm/common/apm_feature_flags.ts b/x-pack/solutions/observability/plugins/apm/common/apm_feature_flags.ts index c151c48d0a018..62edbb15c6d06 100644 --- a/x-pack/solutions/observability/plugins/apm/common/apm_feature_flags.ts +++ b/x-pack/solutions/observability/plugins/apm/common/apm_feature_flags.ts @@ -14,7 +14,6 @@ export enum ApmFeatureFlagName { InfrastructureTabAvailable = 'infrastructureTabAvailable', InfraUiAvailable = 'infraUiAvailable', MigrationToFleetAvailable = 'migrationToFleetAvailable', - ServiceMapUseReactFlow = 'serviceMapUseReactFlow', SourcemapApiAvailable = 'sourcemapApiAvailable', StorageExplorerAvailable = 'storageExplorerAvailable', RuleFormV2Enabled = 'ruleFormV2Enabled', @@ -41,10 +40,6 @@ const apmFeatureFlagMap = { default: true, type: t.boolean, }, - [ApmFeatureFlagName.ServiceMapUseReactFlow]: { - default: false, - type: t.boolean, - }, [ApmFeatureFlagName.SourcemapApiAvailable]: { default: true, type: t.boolean, @@ -72,3 +67,8 @@ export type ValueOfApmFeatureFlag value.default); } + +/** + * The constants below are for feature flags defined using the [Feature Flag Service](https://github.com/elastic/kibana/tree/main/src/core/packages/feature-flags#readme) + */ +export const APM_SERVICE_MAP_USE_REACT_FLOW_FEATURE_FLAG_KEY = 'apm.serviceMapUseReactFlow'; diff --git a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/index.tsx b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/index.tsx index d50c5956c90dc..804c71041a9df 100644 --- a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/index.tsx +++ b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/index.tsx @@ -10,7 +10,6 @@ import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner, EuiPanel, useEuiTheme } f import type { ReactNode } from 'react'; import React, { useEffect, useRef } from 'react'; import { Subscription } from 'rxjs'; -import { useApmFeatureFlag } from '../../../hooks/use_apm_feature_flag'; import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context'; import { isActivePlatinumLicense } from '../../../../common/license_check'; import { invalidLicenseMessage, SERVICE_MAP_TIMEOUT_ERROR } from '../../../../common/service_map'; @@ -36,7 +35,7 @@ import { isReactFlowServiceMapState, isCytoscapeServiceMapState, } from './use_service_map'; -import { ApmFeatureFlagName } from '../../../../common/apm_feature_flags'; +import { APM_SERVICE_MAP_USE_REACT_FLOW_FEATURE_FLAG_KEY } from '../../../../common/apm_feature_flags'; import { ReactFlowServiceMap } from './react_flow_service_map'; function PromptContainer({ children }: { children: ReactNode }) { @@ -106,9 +105,15 @@ export function ServiceMap({ const license = useLicenseContext(); const serviceName = useServiceName(); - const { config } = useApmPluginContext(); + const { + config, + core: { featureFlags }, + } = useApmPluginContext(); const { onPageReady } = usePerformanceContext(); - const showReactFlowServiceMap = useApmFeatureFlag(ApmFeatureFlagName.ServiceMapUseReactFlow); + const showReactFlowServiceMap = featureFlags.getBooleanValue( + APM_SERVICE_MAP_USE_REACT_FLOW_FEATURE_FLAG_KEY, + false + ); const subscriptions = useRef(new Subscription()); diff --git a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/use_service_map.ts b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/use_service_map.ts index b09f32948b438..6116892998206 100644 --- a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/use_service_map.ts +++ b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/use_service_map.ts @@ -18,8 +18,7 @@ import type { Environment } from '../../../../common/environment_rt'; import { getServiceMapNodes, getPaths, transformToReactFlow } from '../../../../common/service_map'; import type { GroupResourceNodesResponse } from '../../../../common/service_map'; import { FETCH_STATUS, useFetcher } from '../../../hooks/use_fetcher'; -import { useApmFeatureFlag } from '../../../hooks/use_apm_feature_flag'; -import { ApmFeatureFlagName } from '../../../../common/apm_feature_flags'; +import { APM_SERVICE_MAP_USE_REACT_FLOW_FEATURE_FLAG_KEY } from '../../../../common/apm_feature_flags'; // Cytoscape format state (legacy) type CytoscapeServiceMapState = GroupResourceNodesResponse & @@ -84,8 +83,14 @@ export const useServiceMap = ({ serviceName?: string; }): UseServiceMapResult => { const license = useLicenseContext(); - const { config } = useApmPluginContext(); - const useReactFlow = useApmFeatureFlag(ApmFeatureFlagName.ServiceMapUseReactFlow); + const { + config, + core: { featureFlags }, + } = useApmPluginContext(); + const useReactFlow = featureFlags.getBooleanValue( + APM_SERVICE_MAP_USE_REACT_FLOW_FEATURE_FLAG_KEY, + false + ); const initialState = useReactFlow ? INITIAL_REACT_FLOW_STATE : INITIAL_CYTOSCAPE_STATE; diff --git a/x-pack/solutions/observability/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx b/x-pack/solutions/observability/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx index 57761c8b4ddad..c98b959064992 100644 --- a/x-pack/solutions/observability/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx +++ b/x-pack/solutions/observability/plugins/apm/public/context/apm_plugin/mock_apm_plugin_context.tsx @@ -162,7 +162,6 @@ const mockConfig: ConfigSchema = { infrastructureTabAvailable: true, infraUiAvailable: true, migrationToFleetAvailable: true, - serviceMapUseReactFlow: false, sourcemapApiAvailable: true, storageExplorerAvailable: true, // to be removed in https://github.com/elastic/kibana/issues/221904 diff --git a/x-pack/solutions/observability/plugins/apm/public/index.ts b/x-pack/solutions/observability/plugins/apm/public/index.ts index c446ecff9161d..22db8f5b90599 100644 --- a/x-pack/solutions/observability/plugins/apm/public/index.ts +++ b/x-pack/solutions/observability/plugins/apm/public/index.ts @@ -23,7 +23,6 @@ export interface ConfigSchema { infrastructureTabAvailable: boolean; infraUiAvailable: boolean; migrationToFleetAvailable: boolean; - serviceMapUseReactFlow: boolean; sourcemapApiAvailable: boolean; storageExplorerAvailable: boolean; // to be removed in https://github.com/elastic/kibana/issues/221904 diff --git a/x-pack/solutions/observability/plugins/apm/server/index.ts b/x-pack/solutions/observability/plugins/apm/server/index.ts index 526a70bf13f48..b11b5683d7815 100644 --- a/x-pack/solutions/observability/plugins/apm/server/index.ts +++ b/x-pack/solutions/observability/plugins/apm/server/index.ts @@ -73,7 +73,6 @@ const configSchema = schema.object({ infrastructureTabAvailable: disabledOnServerless, infraUiAvailable: disabledOnServerless, migrationToFleetAvailable: disabledOnServerless, - serviceMapUseReactFlow: schema.boolean({ defaultValue: false }), sourcemapApiAvailable: disabledOnServerless, storageExplorerAvailable: disabledOnServerless, // to be removed in https://github.com/elastic/kibana/issues/221904 diff --git a/x-pack/solutions/observability/plugins/apm/test/scout_react_flow_service_map/README.md b/x-pack/solutions/observability/plugins/apm/test/scout_react_flow_service_map/README.md index 4916ac2673fd9..528c77d7793b1 100644 --- a/x-pack/solutions/observability/plugins/apm/test/scout_react_flow_service_map/README.md +++ b/x-pack/solutions/observability/plugins/apm/test/scout_react_flow_service_map/README.md @@ -33,5 +33,5 @@ The custom server config is located at: It extends the default config and adds: ``` ---xpack.apm.featureFlags.serviceMapUseReactFlow=true +--feature_flags.overrides.apm.serviceMapUseReactFlow=true ```