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

FullStory: Skip setup for Elasticians #171041

Merged
merged 2 commits into from
Nov 13, 2023
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 @@ -20,17 +20,19 @@ describe('Cloud Plugin', () => {
const setupPlugin = async ({
config = {},
isCloudEnabled = true,
isElasticStaffOwned = false,
}: {
config?: Partial<CloudFullStoryConfigType>;
isCloudEnabled?: boolean;
isElasticStaffOwned?: boolean;
}) => {
const initContext = coreMock.createPluginInitializerContext(config);

const plugin = new CloudFullStoryPlugin(initContext);

const coreSetup = coreMock.createSetup();

const cloud = { ...cloudMock.createSetup(), isCloudEnabled };
const cloud = { ...cloudMock.createSetup(), isCloudEnabled, isElasticStaffOwned };

plugin.setup(coreSetup, { cloud });

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