Skip to content
/ qp-n8n Public
forked from n8n-io/n8n

Commit

Permalink
fix(core): Fix telemetry execution status for manual workflows execut…
Browse files Browse the repository at this point in the history
…ions (n8n-io#5712)

fix telemetry execution status
  • Loading branch information
flipswitchingmonkey authored and sunilrr committed Apr 24, 2023
1 parent ee652e4 commit 9c82c89
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/cli/src/InternalHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ export class InternalHooks implements IInternalHooksClass {
properties.user_id = userId;
}

let executionStatus: ExecutionStatus;
if (runData?.status === 'crashed') {
executionStatus = 'crashed';
} else if (runData?.status === 'waiting' || runData?.data?.waitTill) {
executionStatus = 'waiting';
} else {
executionStatus = properties.success ? 'success' : 'failed';
}

if (runData !== undefined) {
properties.execution_mode = runData.mode;
properties.success = !!runData.finished;
Expand Down Expand Up @@ -342,7 +351,7 @@ export class InternalHooks implements IInternalHooksClass {
const manualExecEventProperties: ITelemetryTrackProperties = {
user_id: userId,
workflow_id: workflow.id,
status: properties.success ? 'success' : 'failed',
status: executionStatus,
executionStatus: runData?.status ?? 'unknown',
error_message: properties.error_message as string,
error_node_type: properties.error_node_type,
Expand Down Expand Up @@ -392,15 +401,6 @@ export class InternalHooks implements IInternalHooksClass {
}
}

let executionStatus: ExecutionStatus;
if (runData?.status === 'crashed') {
executionStatus = 'crashed';
} else if (runData?.status === 'waiting' || runData?.data?.waitTill) {
executionStatus = 'waiting';
} else {
executionStatus = properties.success ? 'success' : 'failed';
}

promises.push(
Db.collections.Execution.update(executionId, {
status: executionStatus,
Expand Down

0 comments on commit 9c82c89

Please sign in to comment.