diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 280def7505..0ebd0f491f 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -380,7 +380,6 @@ export interface IInternalHooksClass { onServerStarted( diagnosticInfo: IDiagnosticInfo, firstWorkflowCreatedAt?: Date, - userId?: string, ): Promise; onPersonalizationSurveySubmitted(userId: string, answers: Record): Promise; onWorkflowCreated(userId: string, workflow: IWorkflowBase, publicApi: boolean): Promise; diff --git a/packages/cli/src/InternalHooks.ts b/packages/cli/src/InternalHooks.ts index 9a25033600..4221b2ac8c 100644 --- a/packages/cli/src/InternalHooks.ts +++ b/packages/cli/src/InternalHooks.ts @@ -32,7 +32,6 @@ export class InternalHooksClass implements IInternalHooksClass { async onServerStarted( diagnosticInfo: IDiagnosticInfo, earliestWorkflowCreatedAt?: Date, - userId?: string, ): Promise { 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, diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index ebabf5899f..2a90700b73 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -1986,21 +1986,14 @@ export async function start(): Promise { 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 }) => { diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index ae8a263bab..43824ff7e8 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -138,38 +138,6 @@ export class Telemetry { }); } - async identify(traits?: { - [key: string]: string | number | boolean | object | undefined | null; - }): Promise { - return new Promise((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 = {},