feat: Implement telemetry for created and updated flows

This commit is contained in:
Faruk AYDIN
2022-05-05 01:13:49 +02:00
parent 4ff6d887ab
commit c5465513ba
2 changed files with 33 additions and 1 deletions

View File

@@ -1,8 +1,9 @@
import { ValidationError } from 'objection';
import type { ModelOptions } from 'objection';
import type { ModelOptions, QueryContext } from 'objection';
import Base from './base';
import Step from './step';
import Execution from './execution';
import Telemetry from '../helpers/telemetry';
class Flow extends Base {
id!: string;
@@ -71,6 +72,16 @@ class Flow extends Base {
return;
}
async $afterInsert(queryContext: QueryContext) {
await super.$afterInsert(queryContext);
Telemetry.flowCreated(this);
}
async $afterUpdate(opt: ModelOptions, queryContext: QueryContext) {
await super.$afterUpdate(opt, queryContext);
Telemetry.flowUpdated(this);
}
}
export default Flow;