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(
diagnosticInfo: IDiagnosticInfo,
firstWorkflowCreatedAt?: Date,
userId?: string,
): Promise<unknown[]>;
onPersonalizationSurveySubmitted(userId: string, answers: Record<string, string>): Promise<void>;
onWorkflowCreated(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise<void>;

View file

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

View file

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

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(
eventName: string,
properties: ITelemetryTrackProperties = {},