feat(core): Workflow Execution Statistics (#4200)

Add recording and reporting of workflow execution statistics
This commit is contained in:
freya
2022-12-06 14:55:40 +00:00
committed by GitHub
parent b71295e4de
commit 1722c6b0c5
28 changed files with 908 additions and 66 deletions

View File

@@ -15,12 +15,13 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable func-names */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { BinaryDataManager, UserSettings, WorkflowExecute } from 'n8n-core';
import { BinaryDataManager, eventEmitter, UserSettings, WorkflowExecute } from 'n8n-core';
import {
IDataObject,
IExecuteData,
IExecuteWorkflowInfo,
INode,
INodeExecutionData,
INodeParameters,
IRun,
@@ -648,9 +649,20 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
this.retryOf,
);
}
} finally {
eventEmitter.emit(
eventEmitter.types.workflowExecutionCompleted,
this.workflowData,
fullRunData,
);
}
},
],
nodeFetchedData: [
async (workflowId: string, node: INode) => {
eventEmitter.emit(eventEmitter.types.nodeFetchedData, workflowId, node);
},
],
};
}
@@ -742,9 +754,20 @@ function hookFunctionsSaveWorker(): IWorkflowExecuteHooks {
this.executionId,
this.retryOf,
);
} finally {
eventEmitter.emit(
eventEmitter.types.workflowExecutionCompleted,
this.workflowData,
fullRunData,
);
}
},
],
nodeFetchedData: [
async (workflowId: string, node: INode) => {
eventEmitter.emit(eventEmitter.types.nodeFetchedData, workflowId, node);
},
],
};
}