feat: Implement telemetry for execution step creation
This commit is contained in:
@@ -5,6 +5,7 @@ import appConfig from '../../config/app';
|
||||
import Step from '../../models/step';
|
||||
import Flow from '../../models/flow';
|
||||
import Execution from '../../models/execution';
|
||||
import ExecutionStep from '../../models/execution-step';
|
||||
|
||||
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
||||
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
||||
@@ -86,6 +87,17 @@ class Telemetry {
|
||||
updatedAt: execution.updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
executionStepCreated(executionStep: ExecutionStep) {
|
||||
this.track('executionStepCreated', {
|
||||
executionStepId: executionStep.id,
|
||||
executionId: executionStep.executionId,
|
||||
stepId: executionStep.stepId,
|
||||
status: executionStep.status,
|
||||
createdAt: executionStep.createdAt,
|
||||
updatedAt: executionStep.updatedAt,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const telemetry = new Telemetry();
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import type { QueryContext } from 'objection';
|
||||
import Base from './base';
|
||||
import Execution from './execution';
|
||||
import Step from './step';
|
||||
import Telemetry from '../helpers/telemetry';
|
||||
|
||||
class ExecutionStep extends Base {
|
||||
id!: string;
|
||||
@@ -44,6 +46,11 @@ class ExecutionStep extends Base {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
async $afterInsert(queryContext: QueryContext) {
|
||||
await super.$afterInsert(queryContext);
|
||||
Telemetry.executionStepCreated(this);
|
||||
}
|
||||
}
|
||||
|
||||
export default ExecutionStep;
|
||||
|
Reference in New Issue
Block a user