mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[EBT] Rename esOrgId
to cloudId
(#130663)
This commit is contained in:
parent
e2202609e8
commit
3648f747a9
4 changed files with 18 additions and 18 deletions
|
@ -17,9 +17,9 @@ export interface EventContext {
|
|||
*/
|
||||
userId?: string;
|
||||
/**
|
||||
* The user's organization ID.
|
||||
* The Cloud ID.
|
||||
*/
|
||||
esOrgId?: string;
|
||||
cloudId?: string;
|
||||
/**
|
||||
* The product's version.
|
||||
*/
|
||||
|
|
|
@ -62,13 +62,13 @@ describe('FullStoryShipper', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('calls `setUserVars` when esOrgId is provided', () => {
|
||||
fullstoryShipper.extendContext({ esOrgId: 'test-es-org-id' });
|
||||
test('calls `setUserVars` when cloudId is provided', () => {
|
||||
fullstoryShipper.extendContext({ cloudId: 'test-es-org-id' });
|
||||
expect(fullStoryApiMock.setUserVars).toHaveBeenCalledWith({ org_id_str: 'test-es-org-id' });
|
||||
});
|
||||
|
||||
test('merges both: version and esOrgId if both are provided', () => {
|
||||
fullstoryShipper.extendContext({ version: '1.2.3', esOrgId: 'test-es-org-id' });
|
||||
test('merges both: version and cloudId if both are provided', () => {
|
||||
fullstoryShipper.extendContext({ version: '1.2.3', cloudId: 'test-es-org-id' });
|
||||
expect(fullStoryApiMock.setUserVars).toHaveBeenCalledWith({
|
||||
org_id_str: 'test-es-org-id',
|
||||
version_str: '1.2.3',
|
||||
|
@ -84,7 +84,7 @@ describe('FullStoryShipper', () => {
|
|||
const context = {
|
||||
userId: 'test-user-id',
|
||||
version: '1.2.3',
|
||||
esOrgId: 'test-es-org-id',
|
||||
cloudId: 'test-es-org-id',
|
||||
foo: 'bar',
|
||||
};
|
||||
fullstoryShipper.extendContext(context);
|
||||
|
|
|
@ -36,7 +36,7 @@ export class FullStoryShipper implements IShipper {
|
|||
this.initContext.logger.debug(`Received context ${JSON.stringify(newContext)}`);
|
||||
|
||||
// FullStory requires different APIs for different type of contexts.
|
||||
const { userId, version, esOrgId, ...nonUserContext } = newContext;
|
||||
const { userId, version, cloudId, ...nonUserContext } = newContext;
|
||||
|
||||
// Call it only when the userId changes
|
||||
if (userId && userId !== this.lastUserId) {
|
||||
|
@ -47,13 +47,13 @@ export class FullStoryShipper implements IShipper {
|
|||
}
|
||||
|
||||
// User-level context
|
||||
if (version || esOrgId) {
|
||||
if (version || cloudId) {
|
||||
this.initContext.logger.debug(
|
||||
`Calling FS.setUserVars with version ${version} and esOrgId ${esOrgId}`
|
||||
`Calling FS.setUserVars with version ${version} and cloudId ${cloudId}`
|
||||
);
|
||||
this.fullStoryApi.setUserVars({
|
||||
...(version ? getParsedVersion(version) : {}),
|
||||
...(esOrgId ? { org_id_str: esOrgId } : {}),
|
||||
...(cloudId ? { org_id_str: cloudId } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ interface SetupFullStoryDeps {
|
|||
interface SetupTelemetryContextDeps extends CloudSetupDependencies {
|
||||
analytics: AnalyticsServiceSetup;
|
||||
executionContextPromise: Promise<ExecutionContextStart>;
|
||||
esOrgId?: string;
|
||||
cloudId?: string;
|
||||
}
|
||||
|
||||
interface SetupChatDeps extends Pick<CloudSetupDependencies, 'security'> {
|
||||
|
@ -120,7 +120,7 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
analytics: core.analytics,
|
||||
security,
|
||||
executionContextPromise,
|
||||
esOrgId: this.config.id,
|
||||
cloudId: this.config.id,
|
||||
}).catch((e) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug(`Error setting up TelemetryContext: ${e.toString()}`);
|
||||
|
@ -278,7 +278,7 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
analytics,
|
||||
security,
|
||||
executionContextPromise,
|
||||
esOrgId,
|
||||
cloudId,
|
||||
}: SetupTelemetryContextDeps) {
|
||||
// Some context providers can be moved to other places for better domain isolation.
|
||||
// Let's use https://github.com/elastic/kibana/issues/125690 for that purpose.
|
||||
|
@ -290,11 +290,11 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
|
||||
analytics.registerContextProvider({
|
||||
name: 'cloud_org_id',
|
||||
context$: of({ esOrgId }),
|
||||
context$: of({ cloudId }),
|
||||
schema: {
|
||||
esOrgId: {
|
||||
cloudId: {
|
||||
type: 'keyword',
|
||||
_meta: { description: 'The Cloud Organization ID', optional: true },
|
||||
_meta: { description: 'The Cloud ID', optional: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -310,7 +310,7 @@ export class CloudPlugin implements Plugin<CloudSetup> {
|
|||
const { sha256 } = await import('js-sha256');
|
||||
// Join the cloud org id and the user to create a truly unique user id.
|
||||
// The hashing here is to keep it at clear as possible in our source code that we do not send literal user IDs
|
||||
return { userId: sha256(esOrgId ? `${esOrgId}:${userId}` : `${userId}`) };
|
||||
return { userId: sha256(cloudId ? `${cloudId}:${userId}` : `${userId}`) };
|
||||
})
|
||||
),
|
||||
schema: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue