Merge pull request #315 from automatisch/feature/telemetry-execution
feat: Implement telemetry for the creation of executions
This commit is contained in:
@@ -4,6 +4,7 @@ import instanceId from './instance-id';
|
||||
import appConfig from '../../config/app';
|
||||
import Step from '../../models/step';
|
||||
import Flow from '../../models/flow';
|
||||
import Execution from '../../models/execution';
|
||||
|
||||
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
||||
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
||||
@@ -75,6 +76,16 @@ class Telemetry {
|
||||
updatedAt: flow.updatedAt,
|
||||
});
|
||||
}
|
||||
|
||||
executionCreated(execution: Execution) {
|
||||
this.track('executionCreated', {
|
||||
executionId: execution.id,
|
||||
flowId: execution.flowId,
|
||||
testRun: execution.testRun,
|
||||
createdAt: execution.createdAt,
|
||||
updatedAt: execution.updatedAt,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const telemetry = new Telemetry();
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import type { QueryContext } from 'objection';
|
||||
import Base from './base';
|
||||
import Flow from './flow';
|
||||
import ExecutionStep from './execution-step';
|
||||
import Telemetry from '../helpers/telemetry';
|
||||
|
||||
class Execution extends Base {
|
||||
id!: string;
|
||||
@@ -38,6 +40,11 @@ class Execution extends Base {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
async $afterInsert(queryContext: QueryContext) {
|
||||
await super.$afterInsert(queryContext);
|
||||
Telemetry.executionCreated(this);
|
||||
}
|
||||
}
|
||||
|
||||
export default Execution;
|
||||
|
Reference in New Issue
Block a user