mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⏪ Revert "⚡ Add userId
to BE PH identify
call"
This reverts commit 895aaa45e5
.
This commit is contained in:
parent
895aaa45e5
commit
b86a098c20
|
@ -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>;
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -1986,21 +1986,14 @@ 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({
|
||||||
order: { createdAt: 'ASC' },
|
select: ['createdAt'],
|
||||||
});
|
order: { createdAt: 'ASC' },
|
||||||
|
})
|
||||||
const sharing = await Db.collections.SharedWorkflow.findOne({
|
.then(async (workflow) =>
|
||||||
where: { workflow: { id: earliestWorkflow?.id } },
|
InternalHooksManager.getInstance().onServerStarted(diagnosticInfo, workflow?.createdAt),
|
||||||
relations: ['workflow'],
|
);
|
||||||
});
|
|
||||||
|
|
||||||
void InternalHooksManager.getInstance().onServerStarted(
|
|
||||||
diagnosticInfo,
|
|
||||||
earliestWorkflow?.createdAt,
|
|
||||||
sharing?.userId,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('error', (error: Error & { code: string }) => {
|
server.on('error', (error: Error & { code: string }) => {
|
||||||
|
|
|
@ -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 = {},
|
||||||
|
|
Loading…
Reference in a new issue