mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[LaunchDarkly] Unhashed deploymentId as userId (#159597)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
5776e97d9c
commit
4172236eb2
6 changed files with 8 additions and 16 deletions
|
@ -168,7 +168,7 @@ xpack.cloud_integrations.experiments.flag_overrides:
|
||||||
|
|
||||||
### How is my user identified?
|
### 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).
|
If you are curious of the data provided to the `identify` call, you can see that in the [`cloud` plugin](../../cloud).
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ describe('Cloud Experiments public plugin', () => {
|
||||||
isElasticStaff: true,
|
isElasticStaff: true,
|
||||||
kibanaVersion: 'version',
|
kibanaVersion: 'version',
|
||||||
trialEndDate: '2020-10-01T14:13:12.000Z',
|
trialEndDate: '2020-10-01T14:13:12.000Z',
|
||||||
userId: '1c2412b751f056aef6e340efa5637d137442d489a4b1e3117071e7c87f8523f2',
|
userId: 'mock-deployment-id',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,6 @@ import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kb
|
||||||
import { get, has } from 'lodash';
|
import { get, has } from 'lodash';
|
||||||
import { duration } from 'moment';
|
import { duration } from 'moment';
|
||||||
import { concatMap } from 'rxjs';
|
import { concatMap } from 'rxjs';
|
||||||
import { Sha256 } from '@kbn/crypto-browser';
|
|
||||||
import type { CloudSetup, CloudStart } from '@kbn/cloud-plugin/public';
|
import type { CloudSetup, CloudStart } from '@kbn/cloud-plugin/public';
|
||||||
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||||
import { LaunchDarklyClient, type LaunchDarklyClientConfig } from './launch_darkly_client';
|
import { LaunchDarklyClient, type LaunchDarklyClientConfig } from './launch_darkly_client';
|
||||||
|
@ -78,9 +77,9 @@ export class CloudExperimentsPlugin
|
||||||
* @param deps {@link CloudExperimentsPluginSetupDeps}
|
* @param deps {@link CloudExperimentsPluginSetupDeps}
|
||||||
*/
|
*/
|
||||||
public setup(core: CoreSetup, deps: 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({
|
this.metadataService.setup({
|
||||||
userId: sha256(deps.cloud.cloudId),
|
userId: deps.cloud.deploymentId,
|
||||||
kibanaVersion: this.kibanaVersion,
|
kibanaVersion: this.kibanaVersion,
|
||||||
trialEndDate: deps.cloud.trialEndDate?.toISOString(),
|
trialEndDate: deps.cloud.trialEndDate?.toISOString(),
|
||||||
isElasticStaff: deps.cloud.isElasticStaffOwned,
|
isElasticStaff: deps.cloud.isElasticStaffOwned,
|
||||||
|
@ -156,7 +155,3 @@ export class CloudExperimentsPlugin
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function sha256(str: string) {
|
|
||||||
return new Sha256().update(str, 'utf8').digest('hex');
|
|
||||||
}
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ describe('Cloud Experiments server plugin', () => {
|
||||||
).mock.instances[0];
|
).mock.instances[0];
|
||||||
advance(100); // Remove the debounceTime effect
|
advance(100); // Remove the debounceTime effect
|
||||||
expect(launchDarklyInstanceMock.updateUserMetadata).toHaveBeenCalledWith({
|
expect(launchDarklyInstanceMock.updateUserMetadata).toHaveBeenCalledWith({
|
||||||
userId: '1c2412b751f056aef6e340efa5637d137442d489a4b1e3117071e7c87f8523f2',
|
userId: 'deployment-id',
|
||||||
kibanaVersion: coreMock.createPluginInitializerContext().env.packageInfo.version,
|
kibanaVersion: coreMock.createPluginInitializerContext().env.packageInfo.version,
|
||||||
isElasticStaff: true,
|
isElasticStaff: true,
|
||||||
trialEndDate: expect.any(String),
|
trialEndDate: expect.any(String),
|
||||||
|
|
|
@ -13,7 +13,6 @@ import type {
|
||||||
Logger,
|
Logger,
|
||||||
} from '@kbn/core/server';
|
} from '@kbn/core/server';
|
||||||
import { get, has } from 'lodash';
|
import { get, has } from 'lodash';
|
||||||
import { createSHA256Hash } from '@kbn/crypto';
|
|
||||||
import type { LogMeta } from '@kbn/logging';
|
import type { LogMeta } from '@kbn/logging';
|
||||||
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server';
|
||||||
import type { CloudSetup } from '@kbn/cloud-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({
|
this.metadataService.setup({
|
||||||
// We use the Cloud ID as the userId in the Cloud Experiments
|
// We use the Cloud Deployment ID as the userId in the Cloud Experiments
|
||||||
userId: createSHA256Hash(deps.cloud.cloudId),
|
userId: deps.cloud.deploymentId,
|
||||||
kibanaVersion: this.initializerContext.env.packageInfo.version,
|
kibanaVersion: this.initializerContext.env.packageInfo.version,
|
||||||
trialEndDate: deps.cloud.trialEndDate?.toISOString(),
|
trialEndDate: deps.cloud.trialEndDate?.toISOString(),
|
||||||
isElasticStaff: deps.cloud.isElasticStaffOwned,
|
isElasticStaff: deps.cloud.isElasticStaffOwned,
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
"@kbn/data-views-plugin",
|
"@kbn/data-views-plugin",
|
||||||
"@kbn/usage-collection-plugin",
|
"@kbn/usage-collection-plugin",
|
||||||
"@kbn/cloud-plugin",
|
"@kbn/cloud-plugin",
|
||||||
"@kbn/crypto-browser",
|
|
||||||
"@kbn/config-schema",
|
"@kbn/config-schema",
|
||||||
"@kbn/crypto",
|
|
||||||
"@kbn/logging",
|
"@kbn/logging",
|
||||||
"@kbn/logging-mocks",
|
"@kbn/logging-mocks",
|
||||||
"@kbn/utility-types",
|
"@kbn/utility-types",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue