diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx b/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx index 96f0a3ed4ca5..d3a41322452f 100755 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/README.mdx @@ -168,7 +168,7 @@ xpack.cloud_integrations.experiments.flag_overrides: ### How is my user identified? -The user is automatically identified during the `setup` phase. It currently uses a hash of the deployment ID, meaning all users accessing the same deployment will get the same values for the `getVariation` requests unless the A/B provider is explicitly configured to randomize it. +The user is automatically identified during the `setup` phase. It currently uses the ESS deployment ID, meaning all users accessing the same deployment will get the same values for the `getVariation` requests unless the A/B provider is explicitly configured to randomize it. If you are curious of the data provided to the `identify` call, you can see that in the [`cloud` plugin](../../cloud). diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.test.ts b/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.test.ts index 05ce6dddf361..9ffc7d63f9ee 100644 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.test.ts +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.test.ts @@ -131,7 +131,7 @@ describe('Cloud Experiments public plugin', () => { isElasticStaff: true, kibanaVersion: 'version', trialEndDate: '2020-10-01T14:13:12.000Z', - userId: '1c2412b751f056aef6e340efa5637d137442d489a4b1e3117071e7c87f8523f2', + userId: 'mock-deployment-id', }); }); }); diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.ts b/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.ts index 90c43fb475a6..3fcdbb84a707 100755 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.ts +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/public/plugin.ts @@ -9,7 +9,6 @@ import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kb import { get, has } from 'lodash'; import { duration } from 'moment'; import { concatMap } from 'rxjs'; -import { Sha256 } from '@kbn/crypto-browser'; import type { CloudSetup, CloudStart } from '@kbn/cloud-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { LaunchDarklyClient, type LaunchDarklyClientConfig } from './launch_darkly_client'; @@ -78,9 +77,9 @@ export class CloudExperimentsPlugin * @param deps {@link CloudExperimentsPluginSetupDeps} */ public setup(core: CoreSetup, deps: CloudExperimentsPluginSetupDeps) { - if (deps.cloud.isCloudEnabled && deps.cloud.cloudId && this.launchDarklyClient) { + if (deps.cloud.isCloudEnabled && deps.cloud.deploymentId && this.launchDarklyClient) { this.metadataService.setup({ - userId: sha256(deps.cloud.cloudId), + userId: deps.cloud.deploymentId, kibanaVersion: this.kibanaVersion, trialEndDate: deps.cloud.trialEndDate?.toISOString(), isElasticStaff: deps.cloud.isElasticStaffOwned, @@ -156,7 +155,3 @@ export class CloudExperimentsPlugin } }; } - -function sha256(str: string) { - return new Sha256().update(str, 'utf8').digest('hex'); -} diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.test.ts b/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.test.ts index d01c085dacd7..37989482dc31 100644 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.test.ts +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.test.ts @@ -116,7 +116,7 @@ describe('Cloud Experiments server plugin', () => { ).mock.instances[0]; advance(100); // Remove the debounceTime effect expect(launchDarklyInstanceMock.updateUserMetadata).toHaveBeenCalledWith({ - userId: '1c2412b751f056aef6e340efa5637d137442d489a4b1e3117071e7c87f8523f2', + userId: 'deployment-id', kibanaVersion: coreMock.createPluginInitializerContext().env.packageInfo.version, isElasticStaff: true, trialEndDate: expect.any(String), diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.ts b/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.ts index 7c7b04fcee3f..151cabd81c49 100755 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.ts +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/server/plugin.ts @@ -13,7 +13,6 @@ import type { Logger, } from '@kbn/core/server'; import { get, has } from 'lodash'; -import { createSHA256Hash } from '@kbn/crypto'; import type { LogMeta } from '@kbn/logging'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import type { CloudSetup } from '@kbn/cloud-plugin/server'; @@ -84,10 +83,10 @@ export class CloudExperimentsPlugin })); } - if (deps.cloud.isCloudEnabled && deps.cloud.cloudId) { + if (deps.cloud.isCloudEnabled && deps.cloud.deploymentId) { this.metadataService.setup({ - // We use the Cloud ID as the userId in the Cloud Experiments - userId: createSHA256Hash(deps.cloud.cloudId), + // We use the Cloud Deployment ID as the userId in the Cloud Experiments + userId: deps.cloud.deploymentId, kibanaVersion: this.initializerContext.env.packageInfo.version, trialEndDate: deps.cloud.trialEndDate?.toISOString(), isElasticStaff: deps.cloud.isElasticStaffOwned, diff --git a/x-pack/plugins/cloud_integrations/cloud_experiments/tsconfig.json b/x-pack/plugins/cloud_integrations/cloud_experiments/tsconfig.json index 8b9e3daf13aa..e1c6ed7b0453 100644 --- a/x-pack/plugins/cloud_integrations/cloud_experiments/tsconfig.json +++ b/x-pack/plugins/cloud_integrations/cloud_experiments/tsconfig.json @@ -15,9 +15,7 @@ "@kbn/data-views-plugin", "@kbn/usage-collection-plugin", "@kbn/cloud-plugin", - "@kbn/crypto-browser", "@kbn/config-schema", - "@kbn/crypto", "@kbn/logging", "@kbn/logging-mocks", "@kbn/utility-types",