Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [ECO][Inventory V2] Turn off entityCentricExperience feature flag by default (#204278) #204648

Merged
merged 2 commits into from
Dec 18, 2024
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 @@ -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 @@ -352,7 +352,7 @@ export const uiSettings: Record<string, UiSettings> = {
},
}),
schema: schema.boolean(),
value: true,
value: false,
requiresPageReload: true,
type: 'boolean',
},
Expand Down
Loading