From 6893de56f4698d8bc946b56d0c426dcd263f561d Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Mon, 13 Nov 2023 10:27:05 -0500 Subject: [PATCH] [8.11] FullStory: Skip setup for Elasticians (#171041) (#171100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.11`: - [FullStory: Skip setup for Elasticians (#171041)](https://github.com/elastic/kibana/pull/171041) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Alejandro Fernández Haro --- .../cloud_full_story/public/plugin.test.ts | 13 ++++++++++++- .../cloud_full_story/public/plugin.ts | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.test.ts b/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.test.ts index 5f241f3ee7f9b..836cafa8ac7af 100644 --- a/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.test.ts +++ b/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.test.ts @@ -20,9 +20,11 @@ describe('Cloud Plugin', () => { const setupPlugin = async ({ config = {}, isCloudEnabled = true, + isElasticStaffOwned = false, }: { config?: Partial; isCloudEnabled?: boolean; + isElasticStaffOwned?: boolean; }) => { const initContext = coreMock.createPluginInitializerContext(config); @@ -30,7 +32,7 @@ describe('Cloud Plugin', () => { const coreSetup = coreMock.createSetup(); - const cloud = { ...cloudMock.createSetup(), isCloudEnabled }; + const cloud = { ...cloudMock.createSetup(), isCloudEnabled, isElasticStaffOwned }; plugin.setup(coreSetup, { cloud }); @@ -61,6 +63,15 @@ describe('Cloud Plugin', () => { expect(coreSetup.analytics.registerShipper).not.toHaveBeenCalled(); }); + it('does set up FullStory when isCloudEnabled=true but the deployment is owned by an Elastician', async () => { + const { coreSetup } = await setupPlugin({ + config: { org_id: 'foo' }, + isCloudEnabled: true, + isElasticStaffOwned: true, + }); + expect(coreSetup.analytics.registerShipper).not.toHaveBeenCalled(); + }); + it('does not call initializeFullStory when org_id is undefined', async () => { const { coreSetup } = await setupPlugin({ config: {} }); expect(coreSetup.analytics.registerShipper).not.toHaveBeenCalled(); diff --git a/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.ts b/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.ts index 66adac5f5fc22..a248b27f93714 100755 --- a/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.ts +++ b/x-pack/plugins/cloud_integrations/cloud_full_story/public/plugin.ts @@ -37,6 +37,12 @@ export class CloudFullStoryPlugin implements Plugin { public setup(core: CoreSetup, { cloud }: CloudFullStorySetupDeps) { if (cloud.isCloudEnabled) { + if (cloud.isElasticStaffOwned) { + this.initializerContext.logger + .get() + .info('Skipping FullStory setup for a Elastic-owned deployments'); + return; + } this.setupFullStory({ analytics: core.analytics, basePath: core.http.basePath }).catch((e) => // eslint-disable-next-line no-console console.debug(`Error setting up FullStory: ${e.toString()}`)