Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum ApmFeatureFlagName {
InfrastructureTabAvailable = 'infrastructureTabAvailable',
InfraUiAvailable = 'infraUiAvailable',
MigrationToFleetAvailable = 'migrationToFleetAvailable',
ServiceMapUseReactFlow = 'serviceMapUseReactFlow',
SourcemapApiAvailable = 'sourcemapApiAvailable',
StorageExplorerAvailable = 'storageExplorerAvailable',
RuleFormV2Enabled = 'ruleFormV2Enabled',
Expand All @@ -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,
Expand Down Expand Up @@ -72,3 +67,8 @@ export type ValueOfApmFeatureFlag<TApmFeatureFlagName extends ApmFeatureFlagName
export function getApmFeatureFlags(): ApmFeatureFlags {
return mapValues(apmFeatureFlagMap, (value, key) => 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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 }) {
Expand Down Expand Up @@ -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<Subscription>(new Subscription());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Loading