feat(core): Workflow Execution Statistics (#4200)
Add recording and reporting of workflow execution statistics
This commit is contained in:
32
packages/cli/src/databases/entities/WorkflowStatistics.ts
Normal file
32
packages/cli/src/databases/entities/WorkflowStatistics.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Column, Entity, RelationId, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { datetimeColumnType } from './AbstractEntity';
|
||||
import { WorkflowEntity } from './WorkflowEntity';
|
||||
|
||||
export enum StatisticsNames {
|
||||
productionSuccess = 'production_success',
|
||||
productionError = 'production_error',
|
||||
manualSuccess = 'manual_success',
|
||||
manualError = 'manual_error',
|
||||
}
|
||||
|
||||
@Entity()
|
||||
export class WorkflowStatistics {
|
||||
@Column()
|
||||
count: number;
|
||||
|
||||
@Column(datetimeColumnType)
|
||||
latestEvent: Date;
|
||||
|
||||
@PrimaryColumn({ length: 128 })
|
||||
name: StatisticsNames;
|
||||
|
||||
@ManyToOne(() => WorkflowEntity, (workflow) => workflow.shared, {
|
||||
primary: true,
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
workflow: WorkflowEntity;
|
||||
|
||||
@RelationId((workflowStatistics: WorkflowStatistics) => workflowStatistics.workflow)
|
||||
@PrimaryColumn()
|
||||
workflowId: number;
|
||||
}
|
||||
Reference in New Issue
Block a user