Skip to content

Commit

Permalink
[ECO][Inventory V2] Turn off entityCentricExperience feature flag by …
Browse files Browse the repository at this point in the history
…default (#204278)

Closes #204238 

## Summary

This PR turns off the`entityCentricExperience` feature flag by default 

| Before | After |
| ------ | ------ |
| <img width="1917" alt="image"
src="https://github.com/user-attachments/assets/dbbe5b84-e16a-4578-8e67-1b3c31406da0"
/>|
![image](https://github.com/user-attachments/assets/20906756-3209-4b16-a44b-eacba6180874)|
|
![image](https://github.com/user-attachments/assets/37e1b6bc-1395-4f32-8e5b-1ddf4afd93b6)|
<img width="343" alt="image"
src="https://github.com/user-attachments/assets/66042e33-2cc9-4aa0-a9c7-e6a441141c08"
/> |
|
![image](https://github.com/user-attachments/assets/16b78af2-f9fc-4263-87cd-9dfa978410da)|
<img width="259" alt="image"
src="https://github.com/user-attachments/assets/37f54dd4-a969-4882-ab41-d94381bc1b23"
/> |
|
![image](https://github.com/user-attachments/assets/90d1b791-8f7f-40c2-a73b-3263cfc17a7f)
|
![image](https://github.com/user-attachments/assets/fd0417b0-5257-4bca-993f-51c08be47c14)|

## Testing
The `entityCentricExperience` feature flag should be turned off by
default and the inventory menu item should not be visible. The inventory
menu item should be visible if the flag is manually turned on.


https://github.com/user-attachments/assets/7bee8ccb-bb29-451e-8a64-22325d9d8477

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Sergi Romeu <[email protected]>
  • Loading branch information
3 people authored Dec 17, 2024
1 parent 15dc9c7 commit 62c99f7
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function useEntityCentricExperienceSetting() {

const isEntityCentricExperienceEnabled = core.uiSettings.get<boolean>(
entityCentricExperience,
true
false
);

return { isEntityCentricExperienceEnabled };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useKibanaContextForPlugin } from './use_kibana';
export function useEntityCentricExperienceSetting() {
const { uiSettings } = useKibanaContextForPlugin().services;

const isEntityCentricExperienceEnabled = uiSettings.get<boolean>(entityCentricExperience, true);
const isEntityCentricExperienceEnabled = uiSettings.get<boolean>(entityCentricExperience);

return { isEntityCentricExperienceEnabled };
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ describe('getDataStreamTypes', () => {
jest.clearAllMocks();
});

it('should return only metrics when entityCentriExperienceEnabled is false and hasMetricsData is true', async () => {
it('should return only metrics when entityCentricExperienceEnabled is false and hasMetricsData is true', async () => {
(getHasMetricsData as jest.Mock).mockResolvedValue(true);

const params = {
entityId: 'entity123',
entityType: 'host' as EntityType,
entityCentriExperienceEnabled: false,
entityCentricExperienceEnabled: false,
infraMetricsClient,
obsEsClient,
entityManagerClient,
Expand All @@ -58,13 +58,13 @@ describe('getDataStreamTypes', () => {
});
});

it('should return an empty array when entityCentriExperienceEnabled is false and hasMetricsData is false', async () => {
it('should return an empty array when entityCentricExperienceEnabled is false and hasMetricsData is false', async () => {
(getHasMetricsData as jest.Mock).mockResolvedValue(false);

const params = {
entityId: 'entity123',
entityType: 'container' as EntityType,
entityCentriExperienceEnabled: false,
entityCentricExperienceEnabled: false,
infraMetricsClient,
obsEsClient,
entityManagerClient,
Expand All @@ -75,7 +75,7 @@ describe('getDataStreamTypes', () => {
expect(result).toEqual([]);
});

it('should return metrics and entity source_data_stream types when entityCentriExperienceEnabled is true and has entity data', async () => {
it('should return metrics and entity source_data_stream types when entityCentricExperienceEnabled is true and has entity data', async () => {
(getHasMetricsData as jest.Mock).mockResolvedValue(true);
(getLatestEntity as jest.Mock).mockResolvedValue({
sourceDataStreamType: ['logs', 'metrics'],
Expand All @@ -84,7 +84,7 @@ describe('getDataStreamTypes', () => {
const params = {
entityId: 'entity123',
entityType: 'host' as EntityType,
entityCentriExperienceEnabled: true,
entityCentricExperienceEnabled: true,
infraMetricsClient,
obsEsClient,
entityManagerClient,
Expand All @@ -104,14 +104,14 @@ describe('getDataStreamTypes', () => {
});
});

it('should return only metrics when entityCentriExperienceEnabled is true but entity data is undefined', async () => {
it('should return only metrics when entityCentricExperienceEnabled is true but entity data is undefined', async () => {
(getHasMetricsData as jest.Mock).mockResolvedValue(true);
(getLatestEntity as jest.Mock).mockResolvedValue(undefined);

const params = {
entityId: 'entity123',
entityType: 'host' as EntityType,
entityCentriExperienceEnabled: true,
entityCentricExperienceEnabled: true,
infraMetricsClient,
obsEsClient,
entityManagerClient,
Expand All @@ -131,7 +131,7 @@ describe('getDataStreamTypes', () => {
const params = {
entityId: 'entity123',
entityType: 'host' as EntityType,
entityCentriExperienceEnabled: true,
entityCentricExperienceEnabled: true,
infraMetricsClient,
obsEsClient,
entityManagerClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import { getLatestEntity } from './get_latest_entity';
interface Params {
entityId: string;
entityType: 'host' | 'container';
entityCentriExperienceEnabled: boolean;
entityCentricExperienceEnabled: boolean;
infraMetricsClient: InfraMetricsClient;
obsEsClient: ObservabilityElasticsearchClient;
entityManagerClient: EntityClient;
logger: Logger;
}

export async function getDataStreamTypes({
entityCentriExperienceEnabled,
entityCentricExperienceEnabled,
entityId,
entityManagerClient,
entityType,
Expand All @@ -42,7 +42,7 @@ export async function getDataStreamTypes({

const sourceDataStreams = new Set(hasMetricsData ? [EntityDataStreamType.METRICS] : []);

if (!entityCentriExperienceEnabled) {
if (!entityCentricExperienceEnabled) {
return Array.from(sourceDataStreams);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export const initEntitiesConfigurationRoutes = (libs: InfraBackendLibs) => {
plugin: `@kbn/${METRICS_APP_ID}-plugin`,
});

const entityCentriExperienceEnabled = await coreContext.uiSettings.client.get(
const entityCentricExperienceEnabled = await coreContext.uiSettings.client.get(
entityCentricExperience
);

try {
const sourceDataStreamTypes = await getDataStreamTypes({
entityCentriExperienceEnabled,
entityCentricExperienceEnabled,
entityId,
entityManagerClient,
entityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ describe.skip('Alert count', () => {
beforeEach(() => {
cy.loginAsSuperUser();

cy.updateAdvancedSettings({
'observability:entityCentricExperience': true,
});

cy.intercept('GET', '/internal/entities/managed/enablement', {
fixture: 'eem_enabled.json',
}).as('getEEMStatus');
Expand All @@ -50,6 +54,9 @@ describe.skip('Alert count', () => {
});

afterEach(() => {
cy.updateAdvancedSettings({
'observability:entityCentricExperience': false,
});
entitiesSynthtrace.clean();
cleanEntityAlerts();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ const end = '2024-10-16T00:15:00.000Z';
describe.skip('Home page', () => {
beforeEach(() => {
cy.loginAsSuperUser();
cy.updateAdvancedSettings({
'observability:entityCentricExperience': true,
});
});

afterEach(() => {
cy.updateAdvancedSettings({
'observability:entityCentricExperience': false,
});
});

describe('When the entityCentricExperience FF is disabled', () => {
it('Shows 404', () => {
cy.updateAdvancedSettings({
'observability:entityCentricExperience': false,
});
cy.visitKibana('/app/inventory');
cy.contains('Application Not Found');
});
});

describe('When EEM is disabled', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ Cypress.Commands.add(
);
}
);

Cypress.Commands.add('updateAdvancedSettings', (settings: Record<string, unknown>) => {
const kibanaUrl = Cypress.env('KIBANA_URL');
cy.request({
log: false,
method: 'POST',
url: `${kibanaUrl}/internal/kibana/settings`,
body: { changes: settings },
headers: {
'kbn-xsrf': 'e2e_test',
},
auth: { user: 'elastic', pass: 'changeme' },
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare namespace Cypress {
password: string;
}): Cypress.Chainable<Cypress.Response<any>>;
getByTestSubj(selector: string): Chainable<JQuery<Element>>;
updateAdvancedSettings(settings: Record<string, unknown>): void;
visitKibana(url: string): void;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class InventoryPlugin
const inventoryAPIClient = createCallInventoryAPI(coreSetup);
const isEntityCentricExperienceSettingEnabled = coreSetup.uiSettings.get<boolean>(
'observability:entityCentricExperience',
true
false
);

this.telemetry.setup({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ export const uiSettings: Record<string, UiSettings> = {
},
}),
schema: schema.boolean(),
value: true,
value: false,
requiresPageReload: true,
type: 'boolean',
},
Expand Down

0 comments on commit 62c99f7

Please sign in to comment.