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 Step from '../../models/step';
|
||||||
import Flow from '../../models/flow';
|
import Flow from '../../models/flow';
|
||||||
import Execution from '../../models/execution';
|
import Execution from '../../models/execution';
|
||||||
|
import ExecutionStep from '../../models/execution-step';
|
||||||
|
|
||||||
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
const WRITE_KEY = '284Py4VgK2MsNYV7xlKzyrALx0v';
|
||||||
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
const DATA_PLANE_URL = 'https://telemetry.automatisch.io/v1/batch';
|
||||||
@@ -86,6 +87,17 @@ class Telemetry {
|
|||||||
updatedAt: execution.updatedAt,
|
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();
|
const telemetry = new Telemetry();
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
|
import type { QueryContext } from 'objection';
|
||||||
import Base from './base';
|
import Base from './base';
|
||||||
import Execution from './execution';
|
import Execution from './execution';
|
||||||
import Step from './step';
|
import Step from './step';
|
||||||
|
import Telemetry from '../helpers/telemetry';
|
||||||
|
|
||||||
class ExecutionStep extends Base {
|
class ExecutionStep extends Base {
|
||||||
id!: string;
|
id!: string;
|
||||||
@@ -44,6 +46,11 @@ class ExecutionStep extends Base {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async $afterInsert(queryContext: QueryContext) {
|
||||||
|
await super.$afterInsert(queryContext);
|
||||||
|
Telemetry.executionStepCreated(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ExecutionStep;
|
export default ExecutionStep;
|
||||||
|
Reference in New Issue
Block a user