Revert " Add userId to BE PH identify call"

This reverts commit 895aaa45e5.
This commit is contained in:
Iván Ovejero 2022-09-08 13:52:39 +02:00
parent 895aaa45e5
commit b86a098c20
4 changed files with 8 additions and 51 deletions

View file

@ -380,7 +380,6 @@ export interface IInternalHooksClass {
onServerStarted( onServerStarted(
diagnosticInfo: IDiagnosticInfo, diagnosticInfo: IDiagnosticInfo,
firstWorkflowCreatedAt?: Date, firstWorkflowCreatedAt?: Date,
userId?: string,
): Promise<unknown[]>; ): Promise<unknown[]>;
onPersonalizationSurveySubmitted(userId: string, answers: Record<string, string>): Promise<void>; onPersonalizationSurveySubmitted(userId: string, answers: Record<string, string>): Promise<void>;
onWorkflowCreated(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise<void>; onWorkflowCreated(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise<void>;

View file

@ -32,7 +32,6 @@ export class InternalHooksClass implements IInternalHooksClass {
async onServerStarted( async onServerStarted(
diagnosticInfo: IDiagnosticInfo, diagnosticInfo: IDiagnosticInfo,
earliestWorkflowCreatedAt?: Date, earliestWorkflowCreatedAt?: Date,
userId?: string,
): Promise<unknown[]> { ): Promise<unknown[]> {
const info = { const info = {
version_cli: diagnosticInfo.versionCli, version_cli: diagnosticInfo.versionCli,
@ -46,11 +45,9 @@ export class InternalHooksClass implements IInternalHooksClass {
n8n_binary_data_mode: diagnosticInfo.binaryDataMode, n8n_binary_data_mode: diagnosticInfo.binaryDataMode,
n8n_multi_user_allowed: diagnosticInfo.n8n_multi_user_allowed, n8n_multi_user_allowed: diagnosticInfo.n8n_multi_user_allowed,
smtp_set_up: diagnosticInfo.smtp_set_up, smtp_set_up: diagnosticInfo.smtp_set_up,
user_id: userId,
}; };
return Promise.all([ return Promise.all([
this.telemetry.identify(info),
this.telemetry.track('Instance started', { this.telemetry.track('Instance started', {
...info, ...info,
earliest_workflow_created: earliestWorkflowCreatedAt, earliest_workflow_created: earliestWorkflowCreatedAt,

View file

@ -1986,20 +1986,13 @@ export async function start(): Promise<void> {
smtp_set_up: config.getEnv('userManagement.emails.mode') === 'smtp', smtp_set_up: config.getEnv('userManagement.emails.mode') === 'smtp',
}; };
const earliestWorkflow = await Db.collections.Workflow.findOne({ void Db.collections
select: ['createdAt', 'id'], .Workflow!.findOne({
select: ['createdAt'],
order: { createdAt: 'ASC' }, order: { createdAt: 'ASC' },
}); })
.then(async (workflow) =>
const sharing = await Db.collections.SharedWorkflow.findOne({ InternalHooksManager.getInstance().onServerStarted(diagnosticInfo, workflow?.createdAt),
where: { workflow: { id: earliestWorkflow?.id } },
relations: ['workflow'],
});
void InternalHooksManager.getInstance().onServerStarted(
diagnosticInfo,
earliestWorkflow?.createdAt,
sharing?.userId,
); );
}); });

View file

@ -138,38 +138,6 @@ export class Telemetry {
}); });
} }
async identify(traits?: {
[key: string]: string | number | boolean | object | undefined | null;
}): Promise<void> {
return new Promise<void>((resolve) => {
if (this.postHog && traits?.user_id) {
this.postHog.identify({
distinctId: [this.instanceId, traits.user_id].join('#'),
properties: {
...traits,
instanceId: this.instanceId,
},
});
}
if (this.rudderStack) {
this.rudderStack.identify(
{
userId: this.instanceId,
anonymousId: '000000000000',
traits: {
...traits,
instanceId: this.instanceId,
},
},
resolve,
);
} else {
resolve();
}
});
}
async track( async track(
eventName: string, eventName: string,
properties: ITelemetryTrackProperties = {}, properties: ITelemetryTrackProperties = {},